Constructor BsonDocument
BsonDocument()
Initializes a new instance of the BsonDocument class.
public BsonDocument()
BsonDocument(bool)
Initializes a new instance of the BsonDocument class specifying whether duplicate element names are allowed (allowing duplicate element names is not recommended).
public BsonDocument(bool allowDuplicateNames)
Parameters
allowDuplicateNamesboolWhether duplicate element names are allowed.
BsonDocument(BsonElement)
Initializes a new instance of the BsonDocument class and adds one element.
public BsonDocument(BsonElement element)
Parameters
elementBsonElementAn element to add to the document.
BsonDocument(BsonDocument)
Initializes a new instance of the BsonDocument by coping elements from another BsonDocument.
public BsonDocument(BsonDocument document)
Parameters
documentBsonDocumentThe document whose elements will be copied
BsonDocument(Dictionary<string, object>)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
public BsonDocument(Dictionary<string, object> dictionary)
Parameters
dictionaryDictionary<string, object>A dictionary to initialize the document from.
BsonDocument(Dictionary<string, object>, IEnumerable<string>)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
[Obsolete("Use BsonDocument(IEnumerable<BsonElement> elements) instead.")]
public BsonDocument(Dictionary<string, object> dictionary, IEnumerable<string> keys)
Parameters
dictionaryDictionary<string, object>A dictionary to initialize the document from.
keysIEnumerable<string>A list of keys to select values from the dictionary.
BsonDocument(IEnumerable<KeyValuePair<string, object>>)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
public BsonDocument(IEnumerable<KeyValuePair<string, object>> dictionary)
Parameters
dictionaryIEnumerable<KeyValuePair<string, object>>A dictionary to initialize the document from.
BsonDocument(IDictionary<string, object>, IEnumerable<string>)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
[Obsolete("Use BsonDocument(IEnumerable<BsonElement> elements) instead.")]
public BsonDocument(IDictionary<string, object> dictionary, IEnumerable<string> keys)
Parameters
dictionaryIDictionary<string, object>A dictionary to initialize the document from.
keysIEnumerable<string>A list of keys to select values from the dictionary.
BsonDocument(IDictionary)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
public BsonDocument(IDictionary dictionary)
Parameters
dictionaryIDictionaryA dictionary to initialize the document from.
BsonDocument(IDictionary, IEnumerable)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
[Obsolete("Use BsonDocument(IEnumerable<BsonElement> elements) instead.")]
public BsonDocument(IDictionary dictionary, IEnumerable keys)
Parameters
dictionaryIDictionaryA dictionary to initialize the document from.
keysIEnumerableA list of keys to select values from the dictionary.
BsonDocument(IEnumerable<BsonElement>)
Initializes a new instance of the BsonDocument class and adds new elements from a list of elements.
public BsonDocument(IEnumerable<BsonElement> elements)
Parameters
elementsIEnumerable<BsonElement>A list of elements to add to the document.
BsonDocument(params BsonElement[])
Initializes a new instance of the BsonDocument class and adds one or more elements.
[Obsolete("Use BsonDocument(IEnumerable<BsonElement> elements) instead.")]
public BsonDocument(params BsonElement[] elements)
Parameters
elementsBsonElement[]One or more elements to add to the document.
BsonDocument(string, BsonValue)
Initializes a new instance of the BsonDocument class and creates and adds a new element.
public BsonDocument(string name, BsonValue value)