Table of Contents

Struct ObjectId

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents an ObjectId (see also BsonObjectId).

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(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.

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.

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.

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.