Table of Contents

Method GenerateNewId

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

GenerateNewId()

Generates a new BsonObjectId with a unique value.

[Obsolete("Use new BsonObjectId(ObjectId.GenerateNewId()) instead.")]
public static BsonObjectId GenerateNewId()

Returns

BsonObjectId

A BsonObjectId.

GenerateNewId(DateTime)

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

[Obsolete("Use new BsonObjectId(ObjectId.GenerateNewId(DateTime timestamp)) instead.")]
public static BsonObjectId GenerateNewId(DateTime timestamp)

Parameters

timestamp DateTime

The timestamp component (expressed as a DateTime).

Returns

BsonObjectId

A BsonObjectId.

GenerateNewId(int)

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

[Obsolete("Use new BsonObjectId(ObjectId.GenerateNewId(int timestamp)) instead.")]
public static BsonObjectId GenerateNewId(int timestamp)

Parameters

timestamp int

The timestamp component.

Returns

BsonObjectId

A BsonObjectId.