Table of Contents

Class BsonWriter

Namespace
MongoDB.Bson.IO
Assembly
MongoDB.Bson.dll

Represents a BSON writer for some external format (see subclasses).

public abstract class BsonWriter : IBsonWriter, IDisposable
Inheritance
BsonWriter
Implements
Derived
Inherited Members
Extension Methods

Constructors

BsonWriter(BsonWriterSettings)

Initializes a new instance of the BsonWriter class.

Properties

Disposed

Gets whether the BsonWriter has been disposed.

Name

Gets the name of the element being written.

Position

Gets the position. Not all writers are able to report the position. Those that can't simply return zero.

SerializationDepth

Gets the current serialization depth.

Settings

Gets the settings of the writer.

State

Gets the current state of the writer.

Methods

Close()

Closes the writer.

Dispose()

Disposes of any resources used by the writer.

Dispose(bool)

Disposes of any resources used by the writer.

Flush()

Flushes any pending data to the output destination.

PopElementNameValidator()

Pops the element name validator.

PopSettings()

Pops the settings.

PushElementNameValidator(IElementNameValidator)

Pushes the element name validator.

PushSettings(Action<BsonWriterSettings>)

Pushes new settings for the writer.

ThrowInvalidContextType(string, ContextType, params ContextType[])

Throws an InvalidOperationException when the method called is not valid for the current ContextType.

ThrowInvalidState(string, params BsonWriterState[])

Throws an InvalidOperationException when the method called is not valid for the current state.

WriteBinaryData(BsonBinaryData)

Writes BSON binary data to the writer.

WriteBoolean(bool)

Writes a BSON Boolean to the writer.

WriteBytes(byte[])

Writes BSON binary data to the writer.

WriteDateTime(long)

Writes a BSON DateTime to the writer.

WriteDecimal128(Decimal128)

Writes a BSON Decimal128 to the writer.

WriteDouble(double)

Writes a BSON Double to the writer.

WriteEndArray()

Writes the end of a BSON array to the writer.

WriteEndDocument()

Writes the end of a BSON document to the writer.

WriteInt32(int)

Writes a BSON Int32 to the writer.

WriteInt64(long)

Writes a BSON Int64 to the writer.

WriteJavaScript(string)

Writes a BSON JavaScript to the writer.

WriteJavaScriptWithScope(string)

Writes a BSON JavaScript to the writer (call WriteStartDocument to start writing the scope).

WriteMaxKey()

Writes a BSON MaxKey to the writer.

WriteMinKey()

Writes a BSON MinKey to the writer.

WriteName(string)

Writes the name of an element to the writer.

WriteNull()

Writes a BSON null to the writer.

WriteObjectId(ObjectId)

Writes a BSON ObjectId to the writer.

WriteRawBsonArray(IByteBuffer)

Writes a raw BSON array.

WriteRawBsonDocument(IByteBuffer)

Writes a raw BSON document.

WriteRegularExpression(BsonRegularExpression)

Writes a BSON regular expression to the writer.

WriteStartArray()

Writes the start of a BSON array to the writer.

WriteStartDocument()

Writes the start of a BSON document to the writer.

WriteString(string)

Writes a BSON String to the writer.

WriteSymbol(string)

Writes a BSON Symbol to the writer.

WriteTimestamp(long)

Writes a BSON timestamp to the writer.

WriteUndefined()

Writes a BSON undefined to the writer.