Table of Contents

Class MaterializedOnDemandBsonDocument

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents a BSON document that is not materialized until you start using it.

[BsonSerializer(typeof(MaterializedOnDemandBsonDocumentSerializer))]
public abstract class MaterializedOnDemandBsonDocument : BsonDocument, IComparable<BsonValue>, IConvertible, IEquatable<BsonValue>, IComparable<BsonDocument>, IConvertibleToBsonDocument, IEnumerable<BsonElement>, IEnumerable, IEquatable<BsonDocument>, IDisposable
Inheritance
MaterializedOnDemandBsonDocument
Implements
Derived
Inherited Members
Extension Methods

Constructors

MaterializedOnDemandBsonDocument()

Initializes a new instance of the MaterializedOnDemandBsonDocument class.

Properties

ElementCount

Gets the number of elements.

Elements

Gets the elements.

IsDisposed

Gets a value indicating whether this instance is disposed.

IsMaterialized

Gets a value indicating whether this instance is materialized.

this[int]

Gets or sets a value by position.

this[string]

Gets or sets a value by name.

Names

Gets the element names.

Values

Gets the values.

Methods

Add(BsonElement)

Adds an element to the document.

Add(string, BsonValue)

Creates and adds an element to the document.

Add(string, BsonValue, 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.

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

CompareTo(BsonDocument)

Compares this document to another document.

CompareTo(BsonValue)

Compares the BsonDocument to another BsonValue.

Contains(string)

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

ContainsValue(BsonValue)

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

DeepClone()

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

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

Equals(object)

Determines whether the specified object, is equal to this instance.

GetElement(int)

Gets an element of this document.

GetElement(string)

Gets an element of this document.

GetEnumerator()

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

GetHashCode()

Returns a hash code for this instance.

GetValue(int)

Gets the value of an element.

GetValue(string)

Gets the value of an element.

GetValue(string, BsonValue)

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

InsertAt(int, BsonElement)

Inserts a new element at a specified position.

Materialize()

Materializes the BsonDocument.

MaterializeCompleted()

Informs subclasses that the Materialize process completed so they can free any resources related to the unmaterialized state.

Merge(BsonDocument)

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

Merge(BsonDocument, bool)

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

Remove(string)

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

RemoveAt(int)

Removes an element from this document.

RemoveElement(BsonElement)

Removes an element from this document.

Set(int, BsonValue)

Sets the value of an element.

Set(string, BsonValue)

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

SetElement(BsonElement)

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

SetElement(int, BsonElement)

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

ThrowIfDisposed()

Throws if disposed.

TryGetElement(string, out BsonElement)

Tries to get an element of this document.

TryGetValue(string, out BsonValue)

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