Table of Contents

Struct BsonWriter

Namespace
Shard.Codecs.Bson
Assembly
Shard.Codecs.dll

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

initialCapacity int

Properties

WrittenMemory

Returns the completed root document while this writer still owns its buffer.

public ReadOnlyMemory<byte> WrittenMemory { get; }

Property Value

ReadOnlyMemory<byte>

Methods

CopyTo(IBufferWriter<byte>)

Copies the completed root document to the destination owned by the caller.

public void CopyTo(IBufferWriter<byte> destination)

Parameters

destination IBufferWriter<byte>

Dispose()

public void Dispose()

WriteBinary(ReadOnlyMemory<byte>, byte)

public void WriteBinary(ReadOnlyMemory<byte> value, byte subtype = 0)

Parameters

value ReadOnlyMemory<byte>
subtype byte

WriteBoolean(bool)

public void WriteBoolean(bool value)

Parameters

value bool

WriteDouble(double)

public void WriteDouble(double value)

Parameters

value double

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

value int

WriteInt64(long)

public void WriteInt64(long value)

Parameters

value long

WriteName(string)

Selects the name for the next value in the current document.

public void WriteName(string name)

Parameters

name string

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

value string

WriteUtcDateTime(long)

public void WriteUtcDateTime(long millisecondsSinceUnixEpoch)

Parameters

millisecondsSinceUnixEpoch long