Table of Contents

Struct BsonReader

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

Reads one complete BSON input while enforcing Shard's depth and framing rules.

public readonly ref struct BsonReader
Inherited Members

Remarks

Binary parsing delegates directly to MongoDB's driver without exposing its types through the public API.

Constructors

BsonReader(ReadOnlyMemory<byte>, int)

public BsonReader(ReadOnlyMemory<byte> source, int maximumDepth = 64)

Parameters

source ReadOnlyMemory<byte>
maximumDepth int

Fields

MaximumSupportedDepth

public const int MaximumSupportedDepth = 64

Field Value

int

Properties

CurrentType

public BsonType CurrentType { get; }

Property Value

BsonType

Methods

CaptureBookmark()

Captures both the driver position and Shard's traversal state.

public BsonReader.Bookmark CaptureBookmark()

Returns

BsonReader.Bookmark

Dispose()

public void Dispose()

ReadBinary()

public BsonBinaryValue ReadBinary()

Returns

BsonBinaryValue

ReadBoolean()

public bool ReadBoolean()

Returns

bool

ReadDouble()

public double ReadDouble()

Returns

double

ReadEndArray()

Closes the current array after every item has been consumed.

public void ReadEndArray()

ReadEndDocument()

Closes the current document after every element value has been consumed.

public void ReadEndDocument()

ReadInt32()

public int ReadInt32()

Returns

int

ReadInt64()

public long ReadInt64()

Returns

long

ReadNull()

public void ReadNull()

ReadStartArray()

Opens the array at the current value.

public void ReadStartArray()

ReadStartDocument()

Opens the current document value, or the root document when no frame is active.

public void ReadStartDocument()

ReadString()

public string ReadString()

Returns

string

ReadUtcDateTime()

public long ReadUtcDateTime()

Returns

long

Restore(in Bookmark)

Returns to a bookmark created by this reader.

public void Restore(in BsonReader.Bookmark bookmark)

Parameters

bookmark BsonReader.Bookmark

SkipValue()

Consumes the current value and checks nested payloads instead of seeking past their bytes.

public void SkipValue()

TryReadArrayValue()

Advances to the next array item and leaves the reader positioned on its value.

public bool TryReadArrayValue()

Returns

bool

false when the current array has no more items.

TryReadElement(out string)

Advances to the next document element and leaves the reader positioned on its value.

public bool TryReadElement(out string name)

Parameters

name string

Returns

bool

false when the current document has no more elements.