Click or drag to resize

ObjectId Structure

Represents an ObjectId (see also BsonObjectId).

Namespace:  MongoDB.Bson
Assembly:  MongoDB.Bson (in MongoDB.Bson.dll) Version: 2.20.0+ee01960089f28ea1b501690df5fc9f6318a70242
Syntax
[SerializableAttribute]
public struct ObjectId : IComparable<ObjectId>, 
	IEquatable<ObjectId>, IConvertible

The ObjectId type exposes the following members.

Constructors
  NameDescription
Public methodObjectId(Byte)
Initializes a new instance of the ObjectId class.
Public methodObjectId(String)
Initializes a new instance of the ObjectId class.
Public methodObjectId(DateTime, Int32, Int16, Int32) Obsolete.
Initializes a new instance of the ObjectId class.
Public methodObjectId(Int32, Int32, Int16, Int32) Obsolete.
Initializes a new instance of the ObjectId class.
Top
Properties
  NameDescription
Public propertyCreationTime
Gets the creation time (derived from the timestamp).
Public propertyStatic memberEmpty
Gets an instance of ObjectId where the value is empty.
Public propertyIncrement Obsolete.
Gets the increment.
Public propertyMachine Obsolete.
Gets the machine.
Public propertyPid Obsolete.
Gets the PID.
Public propertyTimestamp
Gets the timestamp.
Top
Methods
  NameDescription
Public methodCompareTo
Compares this ObjectId to another ObjectId.
Public methodEquals(Object)
Compares this ObjectId to another object.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(ObjectId)
Compares this ObjectId to another ObjectId.
Public methodStatic memberGenerateNewId
Generates a new ObjectId with a unique value.
Public methodStatic memberGenerateNewId(DateTime)
Generates a new ObjectId with a unique value (with the timestamp component based on a given DateTime).
Public methodStatic memberGenerateNewId(Int32)
Generates a new ObjectId with a unique value (with the given timestamp).
Public methodGetHashCode
Gets the hash code.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberPack Obsolete.
Packs the components of an ObjectId into a byte array.
Public methodStatic memberParse
Parses a string and creates a new ObjectId.
Public methodToByteArray
Converts the ObjectId to a byte array.
Public methodToByteArray(Byte, Int32)
Converts the ObjectId to a byte array.
Public methodToString
Returns a string representation of the value.
(Overrides ValueTypeToString.)
Public methodStatic memberTryParse
Tries to parse a string and create a new ObjectId.
Public methodStatic memberUnpack Obsolete.
Unpacks a byte array into the components of an ObjectId.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Compares two ObjectIds.
Public operatorStatic memberGreaterThan
Compares two ObjectIds.
Public operatorStatic memberGreaterThanOrEqual
Compares two ObjectIds.
Public operatorStatic memberInequality
Compares two ObjectIds.
Public operatorStatic memberLessThan
Compares two ObjectIds.
Public operatorStatic memberLessThanOrEqual
Compares two ObjectIds.
Top
Extension Methods
  NameDescription
Public Extension MethodToBson
Serializes an object to a BSON byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument
Serializes an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson
Serializes an object to a JSON string.
(Defined by BsonExtensionMethods.)
Top
See Also