Struct BsonWriter
Writes one BSON root document into an owned output buffer.
public readonly ref struct BsonWriter
- Inherited Members
Remarks
The writer enforces Shard's framing and path rules without exposing MongoDB driver types through the public API.
Constructors
BsonWriter()
public BsonWriter()
BsonWriter(int)
public BsonWriter(int initialCapacity)
Parameters
initialCapacityint
Properties
WrittenMemory
Returns the completed root document while this writer still owns its buffer.
public ReadOnlyMemory<byte> WrittenMemory { get; }
Property Value
Methods
CopyTo(IBufferWriter<byte>)
Copies the completed root document to the destination owned by the caller.
public void CopyTo(IBufferWriter<byte> destination)
Parameters
destinationIBufferWriter<byte>
Dispose()
public void Dispose()
WriteBinary(ReadOnlyMemory<byte>, byte)
public void WriteBinary(ReadOnlyMemory<byte> value, byte subtype = 0)
Parameters
valueReadOnlyMemory<byte>subtypebyte
WriteBoolean(bool)
public void WriteBoolean(bool value)
Parameters
valuebool
WriteDouble(double)
public void WriteDouble(double value)
Parameters
valuedouble
WriteEndArray()
Ends the current array and completes its containing value.
public void WriteEndArray()
WriteEndDocument()
Ends the current document and completes its containing value.
public void WriteEndDocument()
WriteInt32(int)
public void WriteInt32(int value)
Parameters
valueint
WriteInt64(long)
public void WriteInt64(long value)
Parameters
valuelong
WriteName(string)
Selects the name for the next value in the current document.
public void WriteName(string name)
Parameters
namestring
WriteNull()
public void WriteNull()
WriteStartArray()
Starts an array at the current named or array value.
public void WriteStartArray()
WriteStartDocument()
Starts the root document or a document at the current named or array value.
public void WriteStartDocument()
WriteString(string)
public void WriteString(string value)
Parameters
valuestring
WriteUtcDateTime(long)
public void WriteUtcDateTime(long millisecondsSinceUnixEpoch)
Parameters
millisecondsSinceUnixEpochlong