ObjectId StructureMongoDB C# Driver API Documentation
Represents an ObjectId (see also BsonObjectId).

Namespace: MongoDB.Bson
Assembly: MongoDB.Bson (in MongoDB.Bson.dll) Version: { version: '1.11.0.92', semver: '1.11.0', commit: '791a16588d4a8b3b118a8b3b57cfa436fec5d3da', commitDate: '2015-12-08 22:55:45' }
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)
Initializes a new instance of the ObjectId class.
Public methodObjectId(Int32, Int32, Int16, Int32)
Initializes a new instance of the ObjectId class.
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
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 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
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(Type)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, BsonBinaryWriterSettings)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, IBsonSerializationOptions, BsonBinaryWriterSettings)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument(Type)Overloaded.
Converts an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, JsonWriterSettings)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, IBsonSerializationOptions, JsonWriterSettings)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
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
Gets the increment.
Public propertyMachine
Gets the machine.
Public propertyPid
Gets the PID.
Public propertyTimestamp
Gets the timestamp.
Top
See Also

Reference