Method GenerateNewId
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
DateTimeThe 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
intThe timestamp component.
Returns
- BsonObjectId
A BsonObjectId.