Method GenerateId
- Namespace
- MongoDB.Bson.Serialization.IdGenerators
- Assembly
- MongoDB.Bson.dll
GenerateId(object, object)
Generates an ascending Guid for a document. Consecutive invocations should generate Guids that are ascending from a MongoDB perspective
public object GenerateId(object container, object document)
Parameters
container
objectThe container of the document (will be a MongoCollection when called from the driver).
document
objectThe document it was generated for.
Returns
- object
A Guid.
GenerateId(long, byte[], int)
Generates a Guid for a document. Note - this is purely used for unit testing
public object GenerateId(long tickCount, byte[] machineProcessId, int increment)
Parameters
tickCount
longThe time portion of the Guid
machineProcessId
byte[]A 5 byte array with the first 3 bytes representing a machine id and the next 2 representing a process id
increment
intThe increment portion of the Guid. Used to distinguish between 2 Guids that have the timestamp. Note only the least significant 3 bytes are used.
Returns
- object
A Guid.