BsonDocumentGetDocumentId Method MongoDB C# Driver API Documentation

Note: This API is now obsolete.

Gets the Id of the document.

Namespace: MongoDB.Bson
Assembly: MongoDB.Bson (in MongoDB.Bson.dll) Version: { version: '1.11.0.92', semver: '1.11.0', commit: '791a16588d4a8b3b118a8b3b57cfa436fec5d3da', commitDate: '2015-12-08 22:55:45' }
Syntax

[ObsoleteAttribute("GetDocumentId was intended to be private and will become private in a future release. Use document["_id"] or document.GetValue("_id") instead.")]
public virtual bool GetDocumentId(
	out Object id,
	out Type idNominalType,
	out IIdGenerator idGenerator
)

Parameters

id
Type: SystemObject
The Id of the document (the RawValue if it has one, otherwise the element Value).
idNominalType
Type: SystemType
The nominal type of the Id.
idGenerator
Type: MongoDB.Bson.SerializationIIdGenerator
The IdGenerator for the Id (or null).

Return Value

Type: Boolean
True (a BsonDocument either has an Id member or one can be added).

Implements

IBsonSerializableGetDocumentId(Object, Type, IIdGenerator)
See Also

Reference