SequoiaDB
 All Classes Namespaces Files Functions Variables Enumerations Properties Pages
Public Member Functions | Static Public Member Functions | Properties | List of all members
SequoiaDB.Bson.BsonDocument Class Reference

Represents a BSON document. More...

Inheritance diagram for SequoiaDB.Bson.BsonDocument:
SequoiaDB.Bson.BsonValue SequoiaDB.Bson.IConvertibleToBsonDocument

Public Member Functions

 BsonDocument ()
 Initializes a new instance of the BsonDocument class.
 
 BsonDocument (bool allowDuplicateNames)
 Initializes a new instance of the BsonDocument class specifying whether duplicate element names are allowed (allowing duplicate element names is not recommended).
 
 BsonDocument (BsonElement element)
 Initializes a new instance of the BsonDocument class and adds one element.
 
 BsonDocument (Dictionary< string, object > dictionary)
 Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
 
 BsonDocument (Dictionary< string, object > dictionary, IEnumerable< string > keys)
 Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
 
 BsonDocument (IDictionary< string, object > dictionary)
 Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
 
 BsonDocument (IDictionary< string, object > dictionary, IEnumerable< string > keys)
 Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
 
 BsonDocument (IDictionary dictionary)
 Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
 
 BsonDocument (IDictionary dictionary, IEnumerable keys)
 Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.
 
 BsonDocument (IEnumerable< BsonElement > elements)
 Initializes a new instance of the BsonDocument class and adds new elements from a list of elements.
 
 BsonDocument (params BsonElement[] elements)
 Initializes a new instance of the BsonDocument class and adds one or more elements.
 
 BsonDocument (string name, BsonValue value)
 Initializes a new instance of the BsonDocument class and creates and adds a new element.
 
BsonDocument Add (BsonElement element)
 Adds an element to the document.
 
BsonDocument Add (Dictionary< string, object > dictionary)
 Adds elements to the document from a dictionary of key/value pairs.
 
BsonDocument Add (Dictionary< string, object > dictionary, IEnumerable< string > keys)
 Adds elements to the document from a dictionary of key/value pairs.
 
BsonDocument Add (IDictionary< string, object > dictionary)
 Adds elements to the document from a dictionary of key/value pairs.
 
BsonDocument Add (IDictionary< string, object > dictionary, IEnumerable< string > keys)
 Adds elements to the document from a dictionary of key/value pairs.
 
BsonDocument Add (IDictionary dictionary)
 Adds elements to the document from a dictionary of key/value pairs.
 
BsonDocument Add (IDictionary dictionary, IEnumerable keys)
 Adds elements to the document from a dictionary of key/value pairs.
 
BsonDocument Add (IEnumerable< BsonElement > elements)
 Adds a list of elements to the document.
 
BsonDocument Add (params BsonElement[] elements)
 Adds a list of elements to the document.
 
BsonDocument Add (string name, BsonValue value)
 Creates and adds an element to the document.
 
BsonDocument Add (string name, BsonValue value, bool condition)
 Creates and adds an element to the document, but only if the condition is true.
 
void Clear ()
 Clears the document (removes all elements).
 
override BsonValue Clone ()
 Creates a shallow clone of the document (see also DeepClone).
 
int CompareTo (BsonDocument other)
 Compares this document to another document.
 
override int CompareTo (BsonValue other)
 Compares the BsonDocument to another BsonValue.
 
bool Contains (string name)
 Tests whether the document contains an element with the specified name.
 
bool ContainsValue (BsonValue value)
 Tests whether the document contains an element with the specified value.
 
override BsonValue DeepClone ()
 Creates a deep clone of the document (see also Clone).
 
object Deserialize (BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)
 Deserializes the document from a BsonReader.
 
bool GetDocumentId (out object id, out Type idNominalType, out IIdGenerator idGenerator)
 Gets the Id of the document.
 
bool Equals (BsonDocument rhs)
 Compares this document to another document.
 
override bool Equals (object obj)
 Compares this BsonDocument to another object.
 
BsonElement GetElement (int index)
 Gets an element of this document.
 
BsonElement GetElement (string name)
 Gets an element of this document.
 
IEnumerator< BsonElementGetEnumerator ()
 Gets an enumerator that can be used to enumerate the elements of this document.
 
override int GetHashCode ()
 Gets the hash code.
 
BsonValue GetValue (int index)
 Gets the value of an element.
 
BsonValue GetValue (string name)
 Gets the value of an element.
 
BsonValue GetValue (string name, BsonValue defaultValue)
 Gets the value of an element or a default value if the element is not found.
 
void InsertAt (int index, BsonElement element)
 Inserts a new element at a specified position.
 
BsonDocument Merge (BsonDocument document)
 Merges another document into this one. Existing elements are not overwritten.
 
BsonDocument Merge (BsonDocument document, bool overwriteExistingElements)
 Merges another document into this one, specifying whether existing elements are overwritten.
 
void Remove (string name)
 Removes an element from this document (if duplicate element names are allowed then all elements with this name will be removed).
 
void RemoveAt (int index)
 Removes an element from this document.
 
void RemoveElement (BsonElement element)
 Removes an element from this document.
 
void Serialize (BsonWriter bsonWriter, Type nominalType, IBsonSerializationOptions options)
 Serializes this document to a BsonWriter.
 
BsonDocument Set (int index, BsonValue value)
 Sets the value of an element.
 
BsonDocument Set (string name, BsonValue value)
 Sets the value of an element (an element will be added if no element with this name is found).
 
void SetDocumentId (object id)
 Sets the document Id.
 
BsonDocument SetElement (int index, BsonElement element)
 Sets an element of the document (replacing the existing element at that position).
 
BsonDocument SetElement (BsonElement 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).
 
Dictionary< string, object > ToDictionary ()
 Converts the BsonDocument to a Dictionary<string, object>.
 
Hashtable ToHashtable ()
 Converts the BsonDocument to a Hashtable.
 
override string ToString ()
 Returns a string representation of the document.
 
bool TryGetElement (string name, out BsonElement value)
 Tries to get an element of this document.
 
bool TryGetValue (string name, out BsonValue value)
 Tries to get the value of an element of this document.
 
new void WriteTo (BsonWriter bsonWriter)
 Writes the document to a BsonWriter.
 
void WriteTo (BsonBuffer buffer)
 Writes the document to a BsonBuffer.
 
void WriteTo (Stream stream)
 Writes the document to a Stream.
 
void WriteTo (string filename)
 Writes the document to a file.
 
- Public Member Functions inherited from SequoiaDB.Bson.BsonValue
int CompareTypeTo (BsonValue other)
 Compares the type of this BsonValue to the type of another BsonValue.
 
bool Equals (BsonValue rhs)
 Compares this BsonValue to another BsonValue.
 
override bool Equals (object obj)
 Compares this BsonValue to another object.
 
override int GetHashCode ()
 Gets the hash code.
 
bool ToBoolean ()
 Converts this BsonValue to a Boolean (using the JavaScript definition of truthiness).
 
double ToDouble ()
 Converts this BsonValue to a Double.
 
int ToInt32 ()
 Converts this BsonValue to an Int32.
 
long ToInt64 ()
 Converts this BsonValue to an Int64.
 
void WriteTo (BsonWriter bsonWriter)
 Writes the BsonValue to a BsonWriter.
 
- Public Member Functions inherited from SequoiaDB.Bson.IConvertibleToBsonDocument
BsonDocument ToBsonDocument ()
 Converts this object to a BsonDocument.
 

Static Public Member Functions

static bool operator!= (BsonDocument lhs, BsonDocument rhs)
 Compares two BsonDocument values.
 
static bool operator== (BsonDocument lhs, BsonDocument rhs)
 Compares two BsonDocument values.
 
static new BsonDocument Create (object value)
 Creates a new BsonDocument by mapping an object to a BsonDocument.
 
static BsonDocument Parse (string json)
 Parses a JSON string and returns a BsonDocument.
 
static BsonDocument ReadFrom (BsonBuffer buffer)
 Reads a BsonDocument from a BsonBuffer.
 
static new BsonDocument ReadFrom (BsonReader bsonReader)
 Reads a BsonDocument from a BsonReader.
 
static BsonDocument ReadFrom (byte[] bytes)
 Reads a BsonDocument from a byte array.
 
static BsonDocument ReadFrom (byte[] bytes, int index, int count)
 Reads a BsonDocument from a byte array.
 
static BsonDocument ReadFrom (Stream stream)
 Reads a BsonDocument from a stream.
 
static BsonDocument ReadFrom (string filename)
 Reads a BsonDocument from a file.
 
- Static Public Member Functions inherited from SequoiaDB.Bson.BsonValue
static operator bool (BsonValue value)
 Casts a BsonValue to a bool.
 
static operator bool? (BsonValue value)
 Casts a BsonValue to a bool?.
 
static implicit operator BsonValue (bool value)
 Converts a bool to a BsonValue.
 
static implicit operator BsonValue (bool?value)
 Converts a bool? to a BsonValue.
 
static implicit operator BsonValue (byte[] value)
 Converts a byte[] to a BsonValue.
 
static implicit operator BsonValue (DateTime value)
 Converts a DateTime to a BsonValue.
 
static implicit operator BsonValue (DateTime?value)
 Converts a DateTime? to a BsonValue.
 
static implicit operator BsonValue (double value)
 Converts a double to a BsonValue.
 
static implicit operator BsonValue (double?value)
 Converts a double? to a BsonValue.
 
static implicit operator BsonValue (Enum value)
 Converts an Enum to a BsonValue.
 
static implicit operator BsonValue (Guid value)
 Converts a Guid to a BsonValue.
 
static implicit operator BsonValue (Guid?value)
 Converts a Guid? to a BsonValue.
 
static implicit operator BsonValue (int value)
 Converts an int to a BsonValue.
 
static implicit operator BsonValue (int?value)
 Converts an int? to a BsonValue.
 
static implicit operator BsonValue (long value)
 Converts a long to a BsonValue.
 
static implicit operator BsonValue (long?value)
 Converts a long? to a BsonValue.
 
static implicit operator BsonValue (decimal value)
 Converts a decimal to a BsonValue.
 
static implicit operator BsonValue (decimal?value)
 Converts a decimal? to a BsonValue.
 
static implicit operator BsonValue (ObjectId value)
 Converts an ObjectId to a BsonValue.
 
static implicit operator BsonValue (ObjectId?value)
 Converts an ObjectId? to a BsonValue.
 
static implicit operator BsonValue (Regex value)
 Converts a Regex to a BsonValue.
 
static implicit operator BsonValue (string value)
 Converts a string to a BsonValue.
 
static operator byte[] (BsonValue value)
 Casts a BsonValue to a byte[].
 
static operator DateTime (BsonValue value)
 Casts a BsonValue to a DateTime.
 
static operator DateTime? (BsonValue value)
 Casts a BsonValue to a DateTime?.
 
static operator double (BsonValue value)
 Casts a BsonValue to a double.
 
static operator double? (BsonValue value)
 Casts a BsonValue to a double?.
 
static operator Guid (BsonValue value)
 Casts a BsonValue to a Guid.
 
static operator Guid? (BsonValue value)
 Casts a BsonValue to a Guid?.
 
static operator int (BsonValue value)
 Casts a BsonValue to an int.
 
static operator int? (BsonValue value)
 Casts a BsonValue to an int?.
 
static operator long (BsonValue value)
 Casts a BsonValue to a long.
 
static operator long? (BsonValue value)
 Casts a BsonValue to a long?.
 
static operator decimal (BsonValue value)
 Casts a BsonValue to a decimal.
 
static operator decimal? (BsonValue value)
 Casts a BsonValue to a decimal?.
 
static operator ObjectId (BsonValue value)
 Casts a BsonValue to an ObjectId.
 
static operator ObjectId? (BsonValue value)
 Casts a BsonValue to an ObjectId?.
 
static operator Regex (BsonValue value)
 Casts a BsonValue to a Regex.
 
static operator string (BsonValue value)
 Casts a BsonValue to a string.
 
static bool operator< (BsonValue lhs, BsonValue rhs)
 Compares two BsonValues.
 
static bool operator<= (BsonValue lhs, BsonValue rhs)
 Compares two BsonValues.
 
static bool operator!= (BsonValue lhs, BsonValue rhs)
 Compares two BsonValues.
 
static bool operator== (BsonValue lhs, BsonValue rhs)
 Compares two BsonValues.
 
static bool operator> (BsonValue lhs, BsonValue rhs)
 Compares two BsonValues.
 
static bool operator>= (BsonValue lhs, BsonValue rhs)
 Compares two BsonValues.
 
static BsonValue Create (object value)
 Creates a new instance of the BsonValue class.
 
static BsonValue ReadFrom (BsonReader bsonReader)
 Reads one BsonValue from a BsonReader.
 

Properties

bool AllowDuplicateNames [get, set]
 Gets or sets whether to allow duplicate names (allowing duplicate names is not recommended).
 
int ElementCount [get]
 Gets the number of elements.
 
IEnumerable< BsonElementElements [get]
 Gets the elements.
 
IEnumerable< string > Names [get]
 Gets the element names.
 
IEnumerable< object > RawValues [get]
 Gets the raw values (see BsonValue.RawValue).
 
IEnumerable< BsonValueValues [get]
 Gets the values.
 
BsonValue this[int index] [get, set]
 Gets or sets the value of an element.
 
BsonValue this[string name, BsonValue defaultValue] [get]
 Gets the value of an element or a default value if the element is not found.
 
BsonValue this[string name] [get, set]
 Gets or sets the value of an element.
 
- Properties inherited from SequoiaDB.Bson.BsonValue
bool AsBoolean [get]
 Casts the BsonValue to a Boolean (throws an InvalidCastException if the cast is not valid).
 
BsonArray AsBsonArray [get]
 Casts the BsonValue to a BsonArray (throws an InvalidCastException if the cast is not valid).
 
BsonBinaryData AsBsonBinaryData [get]
 Casts the BsonValue to a BsonBinaryData (throws an InvalidCastException if the cast is not valid).
 
BsonDateTime AsBsonDateTime [get]
 Casts the BsonValue to a BsonDateTime (throws an InvalidCastException if the cast is not valid).
 
BsonDocument AsBsonDocument [get]
 Casts the BsonValue to a BsonDocument (throws an InvalidCastException if the cast is not valid).
 
BsonJavaScript AsBsonJavaScript [get]
 Casts the BsonValue to a BsonJavaScript (throws an InvalidCastException if the cast is not valid).
 
BsonJavaScriptWithScope AsBsonJavaScriptWithScope [get]
 Casts the BsonValue to a BsonJavaScriptWithScope (throws an InvalidCastException if the cast is not valid).
 
BsonMaxKey AsBsonMaxKey [get]
 Casts the BsonValue to a BsonMaxKey (throws an InvalidCastException if the cast is not valid).
 
BsonMinKey AsBsonMinKey [get]
 Casts the BsonValue to a BsonMinKey (throws an InvalidCastException if the cast is not valid).
 
BsonNull AsBsonNull [get]
 Casts the BsonValue to a BsonNull (throws an InvalidCastException if the cast is not valid).
 
BsonRegularExpression AsBsonRegularExpression [get]
 Casts the BsonValue to a BsonRegularExpression (throws an InvalidCastException if the cast is not valid).
 
BsonSymbol AsBsonSymbol [get]
 Casts the BsonValue to a BsonSymbol (throws an InvalidCastException if the cast is not valid).
 
BsonTimestamp AsBsonTimestamp [get]
 Casts the BsonValue to a BsonTimestamp (throws an InvalidCastException if the cast is not valid).
 
BsonDecimal AsBsonDecimal [get]
 Casts the BsonValue to a BsonDecimal (throws an InvalidCastException if the cast is not valid).
 
decimal AsDecimal [get]
 Casts the BsonValue to a decimal (throws an InvalidCastException if the cast is not valid).
 
BsonUndefined AsBsonUndefined [get]
 Casts the BsonValue to a BsonUndefined (throws an InvalidCastException if the cast is not valid).
 
BsonValue AsBsonValue [get]
 Casts the BsonValue to a BsonValue (a way of upcasting subclasses of BsonValue to BsonValue at compile time).
 
byte[] AsByteArray [get]
 Casts the BsonValue to a Byte[] (throws an InvalidCastException if the cast is not valid).
 
DateTime AsDateTime [get]
 Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
 
double AsDouble [get]
 Casts the BsonValue to a Double (throws an InvalidCastException if the cast is not valid).
 
Guid AsGuid [get]
 Casts the BsonValue to a Guid (throws an InvalidCastException if the cast is not valid).
 
int AsInt32 [get]
 Casts the BsonValue to an Int32 (throws an InvalidCastException if the cast is not valid).
 
DateTime AsLocalTime [get]
 Casts the BsonValue to a DateTime in the local timezone (throws an InvalidCastException if the cast is not valid).
 
long AsInt64 [get]
 Casts the BsonValue to a Int64 (throws an InvalidCastException if the cast is not valid).
 
bool AsNullableBoolean [get]
 Casts the BsonValue to a Nullable{Boolean} (throws an InvalidCastException if the cast is not valid).
 
DateTime AsNullableDateTime [get]
 Casts the BsonValue to a Nullable{DateTime} (throws an InvalidCastException if the cast is not valid).
 
double AsNullableDouble [get]
 Casts the BsonValue to a Nullable{Double} (throws an InvalidCastException if the cast is not valid).
 
Guid AsNullableGuid [get]
 Casts the BsonValue to a Nullable{Guid} (throws an InvalidCastException if the cast is not valid).
 
int AsNullableInt32 [get]
 Casts the BsonValue to a Nullable{Int32} (throws an InvalidCastException if the cast is not valid).
 
long AsNullableInt64 [get]
 Casts the BsonValue to a Nullable{Int64} (throws an InvalidCastException if the cast is not valid).
 
decimal AsNullableDecimal [get]
 Casts the BsonValue to a Nullable{decimal} (throws an InvalidCastException if the cast is not valid).
 
ObjectId AsNullableObjectId [get]
 Casts the BsonValue to a Nullable{ObjectId} (throws an InvalidCastException if the cast is not valid).
 
ObjectId AsObjectId [get]
 Casts the BsonValue to an ObjectId (throws an InvalidCastException if the cast is not valid).
 
Regex AsRegex [get]
 Casts the BsonValue to a Regex (throws an InvalidCastException if the cast is not valid).
 
string AsString [get]
 Casts the BsonValue to a String (throws an InvalidCastException if the cast is not valid).
 
DateTime AsUniversalTime [get]
 Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
 
BsonType BsonType [get]
 Gets the BsonType of this BsonValue.
 
bool IsBoolean [get]
 Tests whether this BsonValue is a Boolean.
 
bool IsBsonArray [get]
 Tests whether this BsonValue is a BsonArray.
 
bool IsBsonBinaryData [get]
 Tests whether this BsonValue is a BsonBinaryData.
 
bool IsBsonDateTime [get]
 Tests whether this BsonValue is a BsonDateTime.
 
bool IsBsonDocument [get]
 Tests whether this BsonValue is a BsonDocument.
 
bool IsBsonJavaScript [get]
 Tests whether this BsonValue is a BsonJavaScript.
 
bool IsBsonJavaScriptWithScope [get]
 Tests whether this BsonValue is a BsonJavaScriptWithScope.
 
bool IsBsonMaxKey [get]
 Tests whether this BsonValue is a BsonMaxKey.
 
bool IsBsonMinKey [get]
 Tests whether this BsonValue is a BsonMinKey.
 
bool IsBsonNull [get]
 Tests whether this BsonValue is a BsonNull.
 
bool IsBsonRegularExpression [get]
 Tests whether this BsonValue is a BsonRegularExpression.
 
bool IsBsonSymbol [get]
 Tests whether this BsonValue is a BsonSymbol .
 
bool IsBsonTimestamp [get]
 Tests whether this BsonValue is a BsonTimestamp.
 
bool IsBsonDecimal [get]
 Tests whether this BsonValue is a BsonDecimal.
 
bool IsBsonUndefined [get]
 Tests whether this BsonValue is a BsonUndefined.
 
bool IsDateTime [get]
 Tests whether this BsonValue is a DateTime.
 
bool IsDouble [get]
 Tests whether this BsonValue is a Double.
 
bool IsGuid [get]
 Tests whether this BsonValue is a Guid.
 
bool IsInt32 [get]
 Tests whether this BsonValue is an Int32.
 
bool IsInt64 [get]
 Tests whether this BsonValue is an Int64.
 
bool IsNumeric [get]
 Tests whether this BsonValue is a numeric value.
 
bool IsObjectId [get]
 Tests whether this BsonValue is an ObjectId .
 
bool IsString [get]
 Tests whether this BsonValue is a String.
 
virtual object RawValue [get]
 Gets the raw value of this BsonValue (or null if this BsonValue doesn't have a single scalar value).
 

Additional Inherited Members

- Protected Member Functions inherited from SequoiaDB.Bson.BsonValue
 BsonValue (BsonType bsonType)
 Initializes a new instance of the BsonValue class.
 
virtual bool OperatorEqualsImplementation (BsonValue rhs)
 Implementation of operator ==.
 

Detailed Description

Represents a BSON document.

Constructor & Destructor Documentation

SequoiaDB.Bson.BsonDocument.BsonDocument ( )
inline

Initializes a new instance of the BsonDocument class.

SequoiaDB.Bson.BsonDocument.BsonDocument ( bool  allowDuplicateNames)
inline

Initializes a new instance of the BsonDocument class specifying whether duplicate element names are allowed (allowing duplicate element names is not recommended).

Parameters
allowDuplicateNamesWhether duplicate element names are allowed.
SequoiaDB.Bson.BsonDocument.BsonDocument ( BsonElement  element)
inline

Initializes a new instance of the BsonDocument class and adds one element.

Parameters
elementAn element to add to the document.
SequoiaDB.Bson.BsonDocument.BsonDocument ( Dictionary< string, object >  dictionary)
inline

Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.

Parameters
dictionaryA dictionary to initialize the document from.
SequoiaDB.Bson.BsonDocument.BsonDocument ( Dictionary< string, object >  dictionary,
IEnumerable< string >  keys 
)
inline

Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.

Parameters
dictionaryA dictionary to initialize the document from.
keysA list of keys to select values from the dictionary.
SequoiaDB.Bson.BsonDocument.BsonDocument ( IDictionary< string, object >  dictionary)
inline

Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.

Parameters
dictionaryA dictionary to initialize the document from.
SequoiaDB.Bson.BsonDocument.BsonDocument ( IDictionary< string, object >  dictionary,
IEnumerable< string >  keys 
)
inline

Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.

Parameters
dictionaryA dictionary to initialize the document from.
keysA list of keys to select values from the dictionary.
SequoiaDB.Bson.BsonDocument.BsonDocument ( IDictionary  dictionary)
inline

Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.

Parameters
dictionaryA dictionary to initialize the document from.
SequoiaDB.Bson.BsonDocument.BsonDocument ( IDictionary  dictionary,
IEnumerable  keys 
)
inline

Initializes a new instance of the BsonDocument class and adds new elements from a dictionary of key/value pairs.

Parameters
dictionaryA dictionary to initialize the document from.
keysA list of keys to select values from the dictionary.
SequoiaDB.Bson.BsonDocument.BsonDocument ( IEnumerable< BsonElement elements)
inline

Initializes a new instance of the BsonDocument class and adds new elements from a list of elements.

Parameters
elementsA list of elements to add to the document.
SequoiaDB.Bson.BsonDocument.BsonDocument ( params BsonElement[]  elements)
inline

Initializes a new instance of the BsonDocument class and adds one or more elements.

Parameters
elementsOne or more elements to add to the document.
SequoiaDB.Bson.BsonDocument.BsonDocument ( string  name,
BsonValue  value 
)
inline

Initializes a new instance of the BsonDocument class and creates and adds a new element.

Parameters
nameThe name of the element to add to the document.
valueThe value of the element to add to the document.

Member Function Documentation

BsonDocument SequoiaDB.Bson.BsonDocument.Add ( BsonElement  element)
inline

Adds an element to the document.

Parameters
elementThe element to add.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( Dictionary< string, object >  dictionary)
inline

Adds elements to the document from a dictionary of key/value pairs.

Parameters
dictionaryThe dictionary.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( Dictionary< string, object >  dictionary,
IEnumerable< string >  keys 
)
inline

Adds elements to the document from a dictionary of key/value pairs.

Parameters
dictionaryThe dictionary.
keysWhich keys of the hash table to add.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( IDictionary< string, object >  dictionary)
inline

Adds elements to the document from a dictionary of key/value pairs.

Parameters
dictionaryThe dictionary.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( IDictionary< string, object >  dictionary,
IEnumerable< string >  keys 
)
inline

Adds elements to the document from a dictionary of key/value pairs.

Parameters
dictionaryThe dictionary.
keysWhich keys of the hash table to add.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( IDictionary  dictionary)
inline

Adds elements to the document from a dictionary of key/value pairs.

Parameters
dictionaryThe dictionary.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( IDictionary  dictionary,
IEnumerable  keys 
)
inline

Adds elements to the document from a dictionary of key/value pairs.

Parameters
dictionaryThe dictionary.
keysWhich keys of the hash table to add.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( IEnumerable< BsonElement elements)
inline

Adds a list of elements to the document.

Parameters
elementsThe list of elements.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( params BsonElement[]  elements)
inline

Adds a list of elements to the document.

Parameters
elementsThe list of elements.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( string  name,
BsonValue  value 
)
inline

Creates and adds an element to the document.

Parameters
nameThe name of the element.
valueThe value of the element.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Add ( string  name,
BsonValue  value,
bool  condition 
)
inline

Creates and adds an element to the document, but only if the condition is true.

Parameters
nameThe name of the element.
valueThe value of the element.
conditionWhether to add the element to the document.
Returns
The document (so method calls can be chained).
void SequoiaDB.Bson.BsonDocument.Clear ( )
inline

Clears the document (removes all elements).

override BsonValue SequoiaDB.Bson.BsonDocument.Clone ( )
inlinevirtual

Creates a shallow clone of the document (see also DeepClone).

Returns
A shallow clone of the document.

Reimplemented from SequoiaDB.Bson.BsonValue.

int SequoiaDB.Bson.BsonDocument.CompareTo ( BsonDocument  other)
inline

Compares this document to another document.

Parameters
otherThe other document.
Returns
A 32-bit signed integer that indicates whether this document is less than, equal to, or greather than the other.
override int SequoiaDB.Bson.BsonDocument.CompareTo ( BsonValue  other)
inlinevirtual

Compares the BsonDocument to another BsonValue.

Parameters
otherThe other BsonValue.
Returns
A 32-bit signed integer that indicates whether this BsonDocument is less than, equal to, or greather than the other BsonValue.

Implements SequoiaDB.Bson.BsonValue.

bool SequoiaDB.Bson.BsonDocument.Contains ( string  name)
inline

Tests whether the document contains an element with the specified name.

Parameters
nameThe name of the element to look for.
Returns
True if the document contains an element with the specified name.
bool SequoiaDB.Bson.BsonDocument.ContainsValue ( BsonValue  value)
inline

Tests whether the document contains an element with the specified value.

Parameters
valueThe value of the element to look for.
Returns
True if the document contains an element with the specified value.
static new BsonDocument SequoiaDB.Bson.BsonDocument.Create ( object  value)
inlinestatic

Creates a new BsonDocument by mapping an object to a BsonDocument.

Parameters
valueThe object to be mapped to a BsonDocument.
Returns
A BsonDocument.
override BsonValue SequoiaDB.Bson.BsonDocument.DeepClone ( )
inlinevirtual

Creates a deep clone of the document (see also Clone).

Returns
A deep clone of the document.

Reimplemented from SequoiaDB.Bson.BsonValue.

object SequoiaDB.Bson.BsonDocument.Deserialize ( BsonReader  bsonReader,
Type  nominalType,
IBsonSerializationOptions  options 
)
inline

Deserializes the document from a BsonReader.

Parameters
bsonReaderThe BsonReader.
nominalTypeThe nominal type of the object (ignored, but should be BsonDocument).
optionsThe serialization options (ignored).
Returns
The document (which has now been initialized by deserialization), or null.
bool SequoiaDB.Bson.BsonDocument.Equals ( BsonDocument  rhs)
inline

Compares this document to another document.

Parameters
rhsThe other document.
Returns
True if the two documents are equal.
override bool SequoiaDB.Bson.BsonDocument.Equals ( object  obj)
inline

Compares this BsonDocument to another object.

Parameters
objThe other object.
Returns
True if the other object is a BsonDocument and equal to this one.
bool SequoiaDB.Bson.BsonDocument.GetDocumentId ( out object  id,
out Type  idNominalType,
out IIdGenerator  idGenerator 
)
inline

Gets the Id of the document.

Parameters
idThe Id of the document (the RawValue if it has one, otherwise the element Value).
idNominalTypeThe nominal type of the Id.
idGeneratorThe IdGenerator for the Id (or null).
Returns
True (a BsonDocument either has an Id member or one can be added).
BsonElement SequoiaDB.Bson.BsonDocument.GetElement ( int  index)
inline

Gets an element of this document.

Parameters
indexThe zero based index of the element.
Returns
The element.
BsonElement SequoiaDB.Bson.BsonDocument.GetElement ( string  name)
inline

Gets an element of this document.

Parameters
nameThe name of the element.
Returns
A BsonElement.
IEnumerator<BsonElement> SequoiaDB.Bson.BsonDocument.GetEnumerator ( )
inline

Gets an enumerator that can be used to enumerate the elements of this document.

Returns
An enumerator.
override int SequoiaDB.Bson.BsonDocument.GetHashCode ( )
inline

Gets the hash code.

Returns
The hash code.
BsonValue SequoiaDB.Bson.BsonDocument.GetValue ( int  index)
inline

Gets the value of an element.

Parameters
indexThe zero based index of the element.
Returns
The value of the element.
BsonValue SequoiaDB.Bson.BsonDocument.GetValue ( string  name)
inline

Gets the value of an element.

Parameters
nameThe name of the element.
Returns
The value of the element.
BsonValue SequoiaDB.Bson.BsonDocument.GetValue ( string  name,
BsonValue  defaultValue 
)
inline

Gets the value of an element or a default value if the element is not found.

Parameters
nameThe name of the element.
defaultValueThe default value returned if the element is not found.
Returns
The value of the element or the default value if the element is not found.
void SequoiaDB.Bson.BsonDocument.InsertAt ( int  index,
BsonElement  element 
)
inline

Inserts a new element at a specified position.

Parameters
indexThe position of the new element.
elementThe element.
BsonDocument SequoiaDB.Bson.BsonDocument.Merge ( BsonDocument  document)
inline

Merges another document into this one. Existing elements are not overwritten.

Parameters
documentThe other document.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Merge ( BsonDocument  document,
bool  overwriteExistingElements 
)
inline

Merges another document into this one, specifying whether existing elements are overwritten.

Parameters
documentThe other document.
overwriteExistingElementsWhether to overwrite existing elements.
Returns
The document (so method calls can be chained).
static bool SequoiaDB.Bson.BsonDocument.operator!= ( BsonDocument  lhs,
BsonDocument  rhs 
)
inlinestatic

Compares two BsonDocument values.

Parameters
lhsThe first BsonDocument.
rhsThe other BsonDocument.
Returns
True if the two BsonDocument values are not equal according to ==.
static bool SequoiaDB.Bson.BsonDocument.operator== ( BsonDocument  lhs,
BsonDocument  rhs 
)
inlinestatic

Compares two BsonDocument values.

Parameters
lhsThe first BsonDocument.
rhsThe other BsonDocument.
Returns
True if the two BsonDocument values are equal according to ==.
static BsonDocument SequoiaDB.Bson.BsonDocument.Parse ( string  json)
inlinestatic

Parses a JSON string and returns a BsonDocument.

Parameters
jsonThe JSON string.
Returns
A BsonDocument.
static BsonDocument SequoiaDB.Bson.BsonDocument.ReadFrom ( BsonBuffer  buffer)
inlinestatic

Reads a BsonDocument from a BsonBuffer.

Parameters
bufferThe BsonBuffer.
Returns
A BsonDocument.
static new BsonDocument SequoiaDB.Bson.BsonDocument.ReadFrom ( BsonReader  bsonReader)
inlinestatic

Reads a BsonDocument from a BsonReader.

Parameters
bsonReaderThe BsonReader.
Returns
A BsonDocument.
static BsonDocument SequoiaDB.Bson.BsonDocument.ReadFrom ( byte[]  bytes)
inlinestatic

Reads a BsonDocument from a byte array.

Parameters
bytesThe byte array.
Returns
A BsonDocument.
static BsonDocument SequoiaDB.Bson.BsonDocument.ReadFrom ( byte[]  bytes,
int  index,
int  count 
)
inlinestatic

Reads a BsonDocument from a byte array.

Parameters
bytes
index
count
Returns
static BsonDocument SequoiaDB.Bson.BsonDocument.ReadFrom ( Stream  stream)
inlinestatic

Reads a BsonDocument from a stream.

Parameters
streamThe stream.
Returns
A BsonDocument.
static BsonDocument SequoiaDB.Bson.BsonDocument.ReadFrom ( string  filename)
inlinestatic

Reads a BsonDocument from a file.

Parameters
filenameThe name of the file.
Returns
A BsonDocument.
void SequoiaDB.Bson.BsonDocument.Remove ( string  name)
inline

Removes an element from this document (if duplicate element names are allowed then all elements with this name will be removed).

Parameters
nameThe name of the element to remove.
void SequoiaDB.Bson.BsonDocument.RemoveAt ( int  index)
inline

Removes an element from this document.

Parameters
indexThe zero based index of the element to remove.
void SequoiaDB.Bson.BsonDocument.RemoveElement ( BsonElement  element)
inline

Removes an element from this document.

Parameters
elementThe element to remove.
void SequoiaDB.Bson.BsonDocument.Serialize ( BsonWriter  bsonWriter,
Type  nominalType,
IBsonSerializationOptions  options 
)
inline

Serializes this document to a BsonWriter.

Parameters
bsonWriterThe writer.
nominalTypeThe nominalType.
optionsThe serialization options (can be null).
BsonDocument SequoiaDB.Bson.BsonDocument.Set ( int  index,
BsonValue  value 
)
inline

Sets the value of an element.

Parameters
indexThe zero based index of the element whose value is to be set.
valueThe new value.
Returns
The document (so method calls can be chained).
BsonDocument SequoiaDB.Bson.BsonDocument.Set ( string  name,
BsonValue  value 
)
inline

Sets the value of an element (an element will be added if no element with this name is found).

Parameters
nameThe name of the element whose value is to be set.
valueThe new value.
Returns
The document (so method calls can be chained).
void SequoiaDB.Bson.BsonDocument.SetDocumentId ( object  id)
inline

Sets the document Id.

Parameters
idThe value of the Id.
BsonDocument SequoiaDB.Bson.BsonDocument.SetElement ( int  index,
BsonElement  element 
)
inline

Sets an element of the document (replacing the existing element at that position).

Parameters
indexThe zero based index of the element to replace.
elementThe new element.
Returns
The document.
BsonDocument SequoiaDB.Bson.BsonDocument.SetElement ( BsonElement  element)
inline

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).

Parameters
elementThe new element.
Returns
The document.
Dictionary<string, object> SequoiaDB.Bson.BsonDocument.ToDictionary ( )
inline

Converts the BsonDocument to a Dictionary<string, object>.

Returns
A dictionary.
Hashtable SequoiaDB.Bson.BsonDocument.ToHashtable ( )
inline

Converts the BsonDocument to a Hashtable.

Returns
A hashtable.
override string SequoiaDB.Bson.BsonDocument.ToString ( )
inline

Returns a string representation of the document.

Returns
A string representation of the document.
bool SequoiaDB.Bson.BsonDocument.TryGetElement ( string  name,
out BsonElement  value 
)
inline

Tries to get an element of this document.

Parameters
nameThe name of the element.
valueThe element.
Returns
True if an element with that name was found.
bool SequoiaDB.Bson.BsonDocument.TryGetValue ( string  name,
out BsonValue  value 
)
inline

Tries to get the value of an element of this document.

Parameters
nameThe name of the element.
valueThe value of the element.
Returns
True if an element with that name was found.
new void SequoiaDB.Bson.BsonDocument.WriteTo ( BsonWriter  bsonWriter)
inline

Writes the document to a BsonWriter.

Parameters
bsonWriterThe writer.
void SequoiaDB.Bson.BsonDocument.WriteTo ( BsonBuffer  buffer)
inline

Writes the document to a BsonBuffer.

Parameters
bufferThe buffer.
void SequoiaDB.Bson.BsonDocument.WriteTo ( Stream  stream)
inline

Writes the document to a Stream.

Parameters
streamThe stream.
void SequoiaDB.Bson.BsonDocument.WriteTo ( string  filename)
inline

Writes the document to a file.

Parameters
filenameThe name of the file.

Property Documentation

bool SequoiaDB.Bson.BsonDocument.AllowDuplicateNames
getset

Gets or sets whether to allow duplicate names (allowing duplicate names is not recommended).

int SequoiaDB.Bson.BsonDocument.ElementCount
get

Gets the number of elements.

IEnumerable<BsonElement> SequoiaDB.Bson.BsonDocument.Elements
get

Gets the elements.

IEnumerable<string> SequoiaDB.Bson.BsonDocument.Names
get

Gets the element names.

IEnumerable<object> SequoiaDB.Bson.BsonDocument.RawValues
get

Gets the raw values (see BsonValue.RawValue).

BsonValue SequoiaDB.Bson.BsonDocument.this[int index]
getset

Gets or sets the value of an element.

Parameters
indexThe zero based index of the element.
Returns
The value of the element.
BsonValue SequoiaDB.Bson.BsonDocument.this[string name, BsonValue defaultValue]
get

Gets the value of an element or a default value if the element is not found.

Parameters
nameThe name of the element.
defaultValueThe default value to return if the element is not found.
Returns
Teh value of the element or a default value if the element is not found.
BsonValue SequoiaDB.Bson.BsonDocument.this[string name]
getset

Gets or sets the value of an element.

Parameters
nameThe name of the element.
Returns
The value of the element.
IEnumerable<BsonValue> SequoiaDB.Bson.BsonDocument.Values
get

Gets the values.


The documentation for this class was generated from the following file: