Class CommandDocument
Represents a BSON document that can be used where an IMongoCommand is expected.
[BsonSerializer(typeof(CommandDocument.Serializer))]
public class CommandDocument : QueryDocument, IComparable<BsonValue>, IConvertible, IEquatable<BsonValue>, IComparable<BsonDocument>, IConvertibleToBsonDocument, IEnumerable<BsonElement>, IEnumerable, IEquatable<BsonDocument>, IMongoCommand, IMongoQuery
- Inheritance
-
CommandDocument
- Implements
- Inherited Members
- Extension Methods
Constructors
CommandDocument()
Initializes a new instance of the CommandDocument class.
public CommandDocument()
CommandDocument(BsonElement)
Initializes a new instance of the CommandDocument class and adds one element.
public CommandDocument(BsonElement element)
Parameters
elementBsonElementAn element to add to the document.
CommandDocument(params BsonElement[])
Initializes a new instance of the CommandDocument class and adds one or more elements.
[Obsolete("Use CommandDocument<IEnumerable<BsonElement> elements) instead.")]
public CommandDocument(params BsonElement[] elements)
Parameters
elementsBsonElement[]One or more elements to add to the document.
CommandDocument(bool)
Initializes a new instance of the CommandDocument class specifying whether duplicate element names are allowed (allowing duplicate element names is not recommended).
public CommandDocument(bool allowDuplicateNames)
Parameters
allowDuplicateNamesboolWhether duplicate element names are allowed.
CommandDocument(Dictionary<string, object>)
Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
public CommandDocument(Dictionary<string, object> dictionary)
Parameters
dictionaryDictionary<string, object>A dictionary to initialize the document from.
CommandDocument(Dictionary<string, object>, IEnumerable<string>)
Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
[Obsolete("Use CommandDocument<IEnumerable<BsonElement> elements) instead.")]
public CommandDocument(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.
CommandDocument(IDictionary<string, object>, IEnumerable<string>)
Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
[Obsolete("Use CommandDocument<IEnumerable<BsonElement> elements) instead.")]
public CommandDocument(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.
CommandDocument(IEnumerable<BsonElement>)
Initializes a new instance of the CommandDocument class and adds new elements from a list of elements.
public CommandDocument(IEnumerable<BsonElement> elements)
Parameters
elementsIEnumerable<BsonElement>A list of elements to add to the document.
CommandDocument(IEnumerable<KeyValuePair<string, object>>)
Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
public CommandDocument(IEnumerable<KeyValuePair<string, object>> dictionary)
Parameters
dictionaryIEnumerable<KeyValuePair<string, object>>A dictionary to initialize the document from.
CommandDocument(IDictionary)
Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
public CommandDocument(IDictionary dictionary)
Parameters
dictionaryIDictionaryA dictionary to initialize the document from.
CommandDocument(IDictionary, IEnumerable)
Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
[Obsolete("Use CommandDocument<IEnumerable<BsonElement> elements) instead.")]
public CommandDocument(IDictionary dictionary, IEnumerable keys)
Parameters
dictionaryIDictionaryA dictionary to initialize the document from.
keysIEnumerableA list of keys to select values from the dictionary.
CommandDocument(string, BsonValue)
Initializes a new instance of the CommandDocument class and creates and adds a new element.
public CommandDocument(string name, BsonValue value)