BsonWriter ClassMongoDB C# Driver API Documentation
Represents a BSON writer for some external format (see subclasses).
Inheritance Hierarchy

SystemObject
  MongoDB.Bson.IOBsonWriter
    MongoDB.Bson.IOBsonBinaryWriter
    MongoDB.Bson.IOBsonDocumentWriter
    MongoDB.Bson.IOJsonWriter

Namespace: MongoDB.Bson.IO
Assembly: MongoDB.Bson (in MongoDB.Bson.dll) Version: { version: '1.11.0.92', semver: '1.11.0', commit: '791a16588d4a8b3b118a8b3b57cfa436fec5d3da', commitDate: '2015-12-08 22:55:45' }
Syntax

public abstract class BsonWriter : IDisposable

The BsonWriter type exposes the following members.

Constructors

  NameDescription
Protected methodBsonWriter
Initializes a new instance of the BsonWriter class.
Top
Methods

  NameDescription
Protected methodCheckElementName
Checks that the element name is valid.
Public methodClose
Closes the writer.
Public methodStatic memberCreate(Stream)
Creates a BsonWriter to a BSON Stream.
Public methodStatic memberCreate(TextWriter)
Creates a BsonWriter to a JSON TextWriter.
Public methodStatic memberCreate(BsonBinaryWriterSettings)
Creates a BsonWriter to a BsonBuffer.
Public methodStatic memberCreate(BsonBuffer)
Creates a BsonWriter to a BsonBuffer.
Public methodStatic memberCreate(BsonDocument)
Creates a BsonWriter to a BsonDocument.
Public methodStatic memberCreate(Stream, BsonBinaryWriterSettings)
Creates a BsonWriter to a BSON Stream.
Public methodStatic memberCreate(TextWriter, JsonWriterSettings)
Creates a BsonWriter to a JSON TextWriter.
Public methodStatic memberCreate(BsonBuffer, BsonBinaryWriterSettings)
Creates a BsonWriter to a BsonBuffer.
Public methodStatic memberCreate(BsonDocument, BsonDocumentWriterSettings)
Creates a BsonWriter to a BsonDocument.
Public methodDispose
Disposes of any resources used by the writer.
Protected methodDispose(Boolean)
Disposes of any resources used by the writer.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFlush
Flushes any pending data to the output destination.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodThrowInvalidContextType
Throws an InvalidOperationException when the method called is not valid for the current ContextType.
Protected methodThrowInvalidState
Throws an InvalidOperationException when the method called is not valid for the current state.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWriteBinaryData(BsonBinaryData)
Writes BSON binary data to the writer.
Public methodWriteBinaryData(Byte, BsonBinarySubType) Obsolete.
Writes a BSON binary data element to the writer.
Public methodWriteBinaryData(String, BsonBinaryData)
Writes a BSON binary data element to the writer.
Public methodWriteBinaryData(Byte, BsonBinarySubType, GuidRepresentation) Obsolete.
Writes BSON binary data to the writer.
Public methodWriteBinaryData(String, Byte, BsonBinarySubType) Obsolete.
Writes a BSON binary data element to the writer.
Public methodWriteBinaryData(String, Byte, BsonBinarySubType, GuidRepresentation) Obsolete.
Writes a BSON binary data element to the writer.
Public methodWriteBoolean(Boolean)
Writes a BSON Boolean to the writer.
Public methodWriteBoolean(String, Boolean)
Writes a BSON Boolean element to the writer.
Public methodWriteBytes(Byte)
Writes BSON binary data to the writer.
Public methodWriteBytes(String, Byte)
Writes a BSON binary data element to the writer.
Public methodWriteDateTime(Int64)
Writes a BSON DateTime to the writer.
Public methodWriteDateTime(String, Int64)
Writes a BSON DateTime element to the writer.
Public methodWriteDouble(Double)
Writes a BSON Double to the writer.
Public methodWriteDouble(String, Double)
Writes a BSON Double element to the writer.
Public methodWriteEndArray
Writes the end of a BSON array to the writer.
Public methodWriteEndDocument
Writes the end of a BSON document to the writer.
Public methodWriteInt32(Int32)
Writes a BSON Int32 to the writer.
Public methodWriteInt32(String, Int32)
Writes a BSON Int32 element to the writer.
Public methodWriteInt64(Int64)
Writes a BSON Int64 to the writer.
Public methodWriteInt64(String, Int64)
Writes a BSON Int64 element to the writer.
Public methodWriteJavaScript(String)
Writes a BSON JavaScript to the writer.
Public methodWriteJavaScript(String, String)
Writes a BSON JavaScript element to the writer.
Public methodWriteJavaScriptWithScope(String)
Writes a BSON JavaScript to the writer (call WriteStartDocument to start writing the scope).
Public methodWriteJavaScriptWithScope(String, String)
Writes a BSON JavaScript element to the writer (call WriteStartDocument to start writing the scope).
Public methodWriteMaxKey
Writes a BSON MaxKey to the writer.
Public methodWriteMaxKey(String)
Writes a BSON MaxKey element to the writer.
Public methodWriteMinKey
Writes a BSON MinKey to the writer.
Public methodWriteMinKey(String)
Writes a BSON MinKey element to the writer.
Public methodWriteName
Writes the name of an element to the writer.
Public methodWriteNull
Writes a BSON null to the writer.
Public methodWriteNull(String)
Writes a BSON null element to the writer.
Public methodWriteObjectId(ObjectId)
Writes a BSON ObjectId to the writer.
Public methodWriteObjectId(String, ObjectId)
Writes a BSON ObjectId element to the writer.
Public methodWriteObjectId(Int32, Int32, Int16, Int32) Obsolete.
Writes a BSON ObjectId to the writer.
Public methodWriteObjectId(String, Int32, Int32, Int16, Int32) Obsolete.
Writes a BSON ObjectId element to the writer.
Public methodWriteRawBsonArray(IByteBuffer)
Writes a raw BSON array.
Public methodWriteRawBsonArray(String, IByteBuffer)
Writes a raw BSON array.
Public methodWriteRawBsonDocument(IByteBuffer)
Writes a raw BSON document.
Public methodWriteRawBsonDocument(String, IByteBuffer)
Writes a raw BSON document.
Public methodWriteRegularExpression(BsonRegularExpression)
Writes a BSON regular expression to the writer.
Public methodWriteRegularExpression(String, BsonRegularExpression)
Writes a BSON regular expression element to the writer.
Public methodWriteRegularExpression(String, String) Obsolete.
Writes a BSON regular expression to the writer.
Public methodWriteRegularExpression(String, String, String) Obsolete.
Writes a BSON regular expression element to the writer.
Public methodWriteStartArray
Writes the start of a BSON array to the writer.
Public methodWriteStartArray(String)
Writes the start of a BSON array element to the writer.
Public methodWriteStartDocument
Writes the start of a BSON document to the writer.
Public methodWriteStartDocument(String)
Writes the start of a BSON document element to the writer.
Public methodWriteString(String)
Writes a BSON String to the writer.
Public methodWriteString(String, String)
Writes a BSON String element to the writer.
Public methodWriteSymbol(String)
Writes a BSON Symbol to the writer.
Public methodWriteSymbol(String, String)
Writes a BSON Symbol element to the writer.
Public methodWriteTimestamp(Int64)
Writes a BSON timestamp to the writer.
Public methodWriteTimestamp(String, Int64)
Writes a BSON timestamp element to the writer.
Public methodWriteUndefined
Writes a BSON undefined to the writer.
Public methodWriteUndefined(String)
Writes a BSON undefined element to the writer.
Top
Extension Methods

  NameDescription
Public Extension MethodToBson(Type)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, BsonBinaryWriterSettings)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, IBsonSerializationOptions, BsonBinaryWriterSettings)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument(Type)Overloaded.
Converts an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, JsonWriterSettings)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, IBsonSerializationOptions, JsonWriterSettings)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Top
Properties

  NameDescription
Public propertyCheckElementNames
Gets or sets whether to check element names (no periods or leading $).
Public propertyCheckUpdateDocument
Gets or sets whether to check an update document (turns CheckElementNames on if first element name does *not* start with $).
Public propertyDisposed
Gets whether the BsonWriter has been disposed.
Protected propertyName
Gets the name of the element being written.
Public propertySerializationDepth
Gets the current serialization depth.
Public propertySettings
Gets the settings of the writer.
Public propertyState
Gets the current state of the writer.
Top
See Also

Reference