Method Add
Add(BsonElement)
Adds an element to the document.
Parameters
element
BsonElement The element to add.
Returns
- Bson
Document The document (so method calls can be chained).
Add(string, BsonValue)
Creates and adds an element to the document.
Parameters
Returns
- Bson
Document The document (so method calls can be chained).
Add(string, BsonValue, bool)
Creates and adds an element to the document, but only if the condition is true.
Parameters
name
stringThe name of the element.
value
BsonValue The value of the element.
condition
boolWhether to add the element to the document.
Returns
- Bson
Document The document (so method calls can be chained).
Add(string, Func<BsonValue>, bool)
Creates and adds an element to the document, but only if the condition is true. If the condition is false the value factory is not called at all.
Parameters
name
stringThe name of the element.
valueFactory
Func<BsonValue >A delegate called to compute the value of the element if condition is true.
condition
boolWhether to add the element to the document.
Returns
- Bson
Document The document (so method calls can be chained).