Table of Contents

Class RawBsonDocument

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents an immutable BSON document that is represented using only the raw bytes.

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

Constructors

RawBsonDocument(IByteBuffer)

Initializes a new instance of the RawBsonDocument class.

RawBsonDocument(byte[])

Initializes a new instance of the RawBsonDocument class.

Properties

ElementCount

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, BsonValue]

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

Names

Gets the element names.

RawValues

Gets the raw values (see BsonValue.RawValue).

Slice

Gets the slice.

Values

Gets the values.

Methods

Add(BsonElement)

Adds an element to the document.

Add(params BsonElement[])

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

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

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.

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.

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(BsonBinaryReaderSettings)

Materializes the RawBsonDocument into a regular BsonDocument.

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.