Table of Contents

Struct ObjectId

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents an ObjectId (see also BsonObjectId).

[Serializable]
public struct ObjectId : IComparable<ObjectId>, IEquatable<ObjectId>, IConvertible
Implements
Inherited Members
Extension Methods

Constructors

ObjectId(byte[])

Initializes a new instance of the ObjectId class.

ObjectId(DateTime, int, short, int)

Initializes a new instance of the ObjectId class.

ObjectId(int, int, short, int)

Initializes a new instance of the ObjectId class.

ObjectId(string)

Initializes a new instance of the ObjectId class.

Properties

CreationTime

Gets the creation time (derived from the timestamp).

Empty

Gets an instance of ObjectId where the value is empty.

Increment

Gets the increment.

Machine

Gets the machine.

Pid

Gets the PID.

Timestamp

Gets the timestamp.

Methods

CompareTo(ObjectId)

Compares this ObjectId to another ObjectId.

Equals(ObjectId)

Compares this ObjectId to another ObjectId.

Equals(object)

Compares this ObjectId to another object.

GenerateNewId()

Generates a new ObjectId with a unique value.

GenerateNewId(DateTime)

Generates a new ObjectId with a unique value (with the timestamp component based on a given DateTime).

GenerateNewId(int)

Generates a new ObjectId with a unique value (with the given timestamp).

GetHashCode()

Gets the hash code.

Pack(int, int, short, int)

Packs the components of an ObjectId into a byte array.

Parse(string)

Parses a string and creates a new ObjectId.

ToByteArray()

Converts the ObjectId to a byte array.

ToByteArray(byte[], int)

Converts the ObjectId to a byte array.

ToString()

Returns a string representation of the value.

TryParse(string, out ObjectId)

Tries to parse a string and create a new ObjectId.

Unpack(byte[], out int, out int, out short, out int)

Unpacks a byte array into the components of an ObjectId.

Operators

operator ==(ObjectId, ObjectId)

Compares two ObjectIds.

operator >(ObjectId, ObjectId)

Compares two ObjectIds.

operator >=(ObjectId, ObjectId)

Compares two ObjectIds.

operator !=(ObjectId, ObjectId)

Compares two ObjectIds.

operator <(ObjectId, ObjectId)

Compares two ObjectIds.

operator <=(ObjectId, ObjectId)

Compares two ObjectIds.