Class BsonDocument
Represents a BSON document.
[Serializable]
public class BsonDocument : BsonValue, IComparable<BsonValue>, IConvertible, IEquatable<BsonValue>, IComparable<BsonDocument>, IConvertibleToBsonDocument, IEnumerable<BsonElement>, IEnumerable, IEquatable<BsonDocument>
- Inheritance
-
Bson
Document
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
- Bson
Document() Initializes a new instance of the BsonDocument class.
- Bson
Document(Bson Element) Initializes a new instance of the BsonDocument class and adds one element.
- Bson
Document(params Bson Element[]) Initializes a new instance of the BsonDocument class and adds one or more elements.
- Bson
Document(bool) Initializes a new instance of the BsonDocument class specifying whether duplicate element names are allowed (allowing duplicate element names is not recommended).
- BsonDocument(Dictionary<string, object>)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
- 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.
- 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.
- BsonDocument(IEnumerable<BsonElement>)
Initializes a new instance of the BsonDocument class and adds new elements from a list of elements.
- BsonDocument(IEnumerable<KeyValuePair<string, object>>)
Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
- Bson
Document(IDictionary) Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
- Bson
Document(IDictionary, IEnumerable) Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
- Bson
Document(string, Bson Value) Initializes a new instance of the BsonDocument class and creates and adds a new element.
Properties
- Allow
Duplicate Names Gets or sets whether to allow duplicate names (allowing duplicate names is not recommended).
- Bson
Type Gets the BsonType of this BsonValue.
- Element
Count Gets the number of elements.
- Elements
Gets the elements.
- this[int]
Gets or sets a value by position.
- this[string]
Gets or sets a value by name.
- this[string,
Bson Value] Gets the value of an element or a default value if the element is not found.
- Names
Gets the element names.
- Raw
Values Gets the raw values (see BsonValue.RawValue).
- Values
Gets the values.
Methods
- Add(Bson
Element) Adds an element to the document.
- Add(params Bson
Element[]) Adds a list of elements to the document.
- Add(Dictionary<string, object>)
Adds elements to the document from a dictionary of key/value pairs.
- Add(Dictionary<string, object>, IEnumerable<string>)
Adds elements to the document from a dictionary of key/value pairs.
- Add(IDictionary<string, object>)
Adds elements to the document from a dictionary of key/value pairs.
- Add(IDictionary<string, object>, IEnumerable<string>)
Adds elements to the document from a dictionary of key/value pairs.
- Add(IEnumerable<BsonElement>)
Adds a list of elements to the document.
- Add(IDictionary)
Adds elements to the document from a dictionary of key/value pairs.
- Add(IDictionary,
IEnumerable) Adds elements to the document from a dictionary of key/value pairs.
- Add(string,
Bson Value) Creates and adds an element to the document.
- Add(string,
Bson Value, bool) Creates and adds an element to the document, but only if the condition is true.
- 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.
- AddRange(Dictionary<string, object>)
Adds elements to the document from a dictionary of key/value pairs.
- AddRange(IEnumerable<BsonElement>)
Adds a list of elements to the document.
- AddRange(IEnumerable<KeyValuePair<string, object>>)
Adds elements to the document from a dictionary of key/value pairs.
- Add
Range(IDictionary) Adds elements to the document from a dictionary of key/value pairs.
- Clear()
Clears the document (removes all elements).
- Clone()
Creates a shallow clone of the document (see also DeepClone).
- Compare
To(Bson Document) Compares this document to another document.
- Compare
To(Bson Value) Compares the BsonDocument to another BsonValue.
- Contains(string)
Tests whether the document contains an element with the specified name.
- Contains
Value(Bson Value) Tests whether the document contains an element with the specified value.
- Create(object)
Creates a new BsonDocument by mapping an object to a BsonDocument.
- Deep
Clone() Creates a deep clone of the document (see also Clone).
- Equals(Bson
Document) Compares this document to another document.
- Equals(object)
Compares this BsonDocument to another object.
- Get
Element(int) Gets an element of this document.
- Get
Element(string) Gets an element of this document.
- Get
Enumerator() Gets an enumerator that can be used to enumerate the elements of this document.
- Get
Hash Code() Gets the hash code.
- Get
Value(int) Gets the value of an element.
- Get
Value(string) Gets the value of an element.
- Get
Value(string, Bson Value) Gets the value of an element or a default value if the element is not found.
- Index
OfName(string) Gets the index of an element.
- Insert
At(int, Bson Element) Inserts a new element at a specified position.
- Merge(Bson
Document) Merges another document into this one. Existing elements are not overwritten.
- Merge(Bson
Document, bool) Merges another document into this one, specifying whether existing elements are overwritten.
- Parse(string)
Parses a JSON string and returns a BsonDocument.
- Remove(string)
Removes an element from this document (if duplicate element names are allowed then all elements with this name will be removed).
- Remove
At(int) Removes an element from this document.
- Remove
Element(Bson Element) Removes an element from this document.
- Set(int,
Bson Value) Sets the value of an element.
- Set(string,
Bson Value) Sets the value of an element (an element will be added if no element with this name is found).
- Set
Element(Bson Element) Sets an element of the document (replaces any existing element with the same name or adds a new element if an element with the same name is not found).
- Set
Element(int, Bson Element) Sets an element of the document (replacing the existing element at that position).
- To
Dictionary() Converts the BsonDocument to a Dictionary<string, object>.
- To
Hashtable() Converts the BsonDocument to a Hashtable.
- To
String() Returns a string representation of the document.
- Try
Get Element(string, out Bson Element) Tries to get an element of this document.
- Try
Get Value(string, out Bson Value) Tries to get the value of an element of this document.
- Try
Parse(string, out Bson Document) Tries to parse a JSON string and returns a value indicating whether it succeeded or failed.
Operators
- operator ==(Bson
Document, Bson Document) Compares two BsonDocument values.
- operator !=(Bson
Document, Bson Document) Compares two BsonDocument values.