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(Dictionary<string, object>)
Adds elements to the document from a dictionary of key/value pairs.
[Obsolete("Use AddRange instead.")]
public override BsonDocument Add(Dictionary<string, object> dictionary)
Parameters
dictionary
Dictionary<string, object>The dictionary.
Returns
- Bson
Document The document (so method calls can be chained).
Add(Dictionary<string, object>, IEnumerable<string>)
Adds elements to the document from a dictionary of key/value pairs.
[Obsolete("Use AddRange(IEnumerable<BsonElement> elements) instead.")]
public override BsonDocument Add(Dictionary<string, object> dictionary, IEnumerable<string> keys)
Parameters
dictionary
Dictionary<string, object>The dictionary.
keys
IEnumerable<string>Which keys of the hash table to add.
Returns
- Bson
Document The document (so method calls can be chained).
Add(IDictionary<string, object>)
Adds elements to the document from a dictionary of key/value pairs.
[Obsolete("Use AddRange instead.")]
public override BsonDocument Add(IDictionary<string, object> dictionary)
Parameters
dictionary
IDictionary<string, object>The dictionary.
Returns
- Bson
Document The document (so method calls can be chained).
Add(IDictionary<string, object>, IEnumerable<string>)
Adds elements to the document from a dictionary of key/value pairs.
[Obsolete("Use AddRange(IEnumerable<BsonElement> elements) instead.")]
public override BsonDocument Add(IDictionary<string, object> dictionary, IEnumerable<string> keys)
Parameters
dictionary
IDictionary<string, object>The dictionary.
keys
IEnumerable<string>Which keys of the hash table to add.
Returns
- Bson
Document The document (so method calls can be chained).
Add(IDictionary)
Adds elements to the document from a dictionary of key/value pairs.
Parameters
dictionary
IDictionaryThe dictionary.
Returns
- Bson
Document The document (so method calls can be chained).
Add(IDictionary, IEnumerable)
Adds elements to the document from a dictionary of key/value pairs.
[Obsolete("Use AddRange(IEnumerable<BsonElement> elements) instead.")]
public override BsonDocument Add(IDictionary dictionary, IEnumerable keys)
Parameters
dictionary
IDictionaryThe dictionary.
keys
IEnumerableWhich keys of the hash table to add.
Returns
- Bson
Document The document (so method calls can be chained).
Add(IEnumerable<BsonElement>)
Adds a list of elements to the document.
[Obsolete("Use AddRange instead.")]
public override BsonDocument Add(IEnumerable<BsonElement> elements)
Parameters
elements
IEnumerable<BsonElement >The list of elements.
Returns
- Bson
Document The document (so method calls can be chained).
Add(params BsonElement[])
Adds a list of elements to the document.
[Obsolete("Use AddRange(IEnumerable<BsonElement> elements) instead.")]
public override BsonDocument Add(params BsonElement[] elements)
Parameters
elements
BsonElement []The list of elements.
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).