Table of Contents

Method GenerateNewId

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

GenerateNewId()

Generates a new ObjectId with a unique value.

public static ObjectId GenerateNewId()

Returns

ObjectId

An ObjectId.

GenerateNewId(DateTime)

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

public static ObjectId GenerateNewId(DateTime timestamp)

Parameters

timestamp DateTime

The timestamp component (expressed as a DateTime).

Returns

ObjectId

An ObjectId.

GenerateNewId(int)

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

public static ObjectId GenerateNewId(int timestamp)

Parameters

timestamp int

The timestamp component.

Returns

ObjectId

An ObjectId.