Table of Contents

Class IBsonReaderExtensions

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

Contains extensions methods for IBsonReader.

public static class IBsonReaderExtensions
Inheritance
IBsonReaderExtensions
Inherited Members

Methods

FindElement(IBsonReader, string)

Positions the reader to an element by name.

public static bool FindElement(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

bool

True if the element was found.

FindStringElement(IBsonReader, string)

Positions the reader to a string element by name.

public static string FindStringElement(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

string

True if the element was found.

ReadBinaryData(IBsonReader, string)

Reads a BSON binary data element from the reader.

public static BsonBinaryData ReadBinaryData(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

BsonBinaryData

A BsonBinaryData.

ReadBinaryDataWithGuidRepresentationUnspecified(IBsonReader)

Reads a BSON binary data element from the reader temporarily setting the GuidRepresentation to Unspecified.

[Obsolete("In V3 mode use ReadBinaryData instead.")]
public static BsonBinaryData ReadBinaryDataWithGuidRepresentationUnspecified(this IBsonReader reader)

Parameters

reader IBsonReader

The reader.

Returns

BsonBinaryData

A BsonBinaryData.

ReadBoolean(IBsonReader, string)

Reads a BSON boolean element from the reader.

public static bool ReadBoolean(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

bool

A Boolean.

ReadBytes(IBsonReader, string)

Reads a BSON binary data element from the reader.

public static byte[] ReadBytes(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

byte[]

A byte array.

ReadDateTime(IBsonReader, string)

Reads a BSON DateTime element from the reader.

public static long ReadDateTime(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

long

The number of milliseconds since the Unix epoch.

ReadDecimal128(IBsonReader, string)

Reads a BSON Decimal128 element from the reader.

public static Decimal128 ReadDecimal128(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

Decimal128

A Decimal128.

ReadDouble(IBsonReader, string)

Reads a BSON Double element from the reader.

public static double ReadDouble(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

double

A Double.

ReadInt32(IBsonReader, string)

Reads a BSON Int32 element from the reader.

public static int ReadInt32(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

int

An Int32.

ReadInt64(IBsonReader, string)

Reads a BSON Int64 element from the reader.

public static long ReadInt64(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

long

An Int64.

ReadJavaScript(IBsonReader, string)

Reads a BSON JavaScript element from the reader.

public static string ReadJavaScript(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

string

A string.

ReadJavaScriptWithScope(IBsonReader, string)

Reads a BSON JavaScript with scope element from the reader (call ReadStartDocument next to read the scope).

public static string ReadJavaScriptWithScope(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

string

A string.

ReadMaxKey(IBsonReader, string)

Reads a BSON MaxKey element from the reader.

public static void ReadMaxKey(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

ReadMinKey(IBsonReader, string)

Reads a BSON MinKey element from the reader.

public static void ReadMinKey(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

ReadName(IBsonReader)

Reads the name of an element from the reader.

public static string ReadName(this IBsonReader reader)

Parameters

reader IBsonReader

The reader.

Returns

string

The name of the element.

ReadName(IBsonReader, string)

Reads the name of an element from the reader.

public static void ReadName(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

ReadNull(IBsonReader, string)

Reads a BSON null element from the reader.

public static void ReadNull(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

ReadObjectId(IBsonReader, string)

Reads a BSON ObjectId element from the reader.

public static ObjectId ReadObjectId(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

ObjectId

An ObjectId.

ReadRawBsonArray(IBsonReader, string)

Reads a raw BSON array.

public static IByteBuffer ReadRawBsonArray(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name.

Returns

IByteBuffer

The raw BSON array.

ReadRawBsonDocument(IBsonReader, string)

Reads a raw BSON document.

public static IByteBuffer ReadRawBsonDocument(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name.

Returns

IByteBuffer

The raw BSON document.

ReadRegularExpression(IBsonReader, string)

Reads a BSON regular expression element from the reader.

public static BsonRegularExpression ReadRegularExpression(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

BsonRegularExpression

A BsonRegularExpression.

ReadString(IBsonReader, string)

Reads a BSON string element from the reader.

public static string ReadString(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

string

A String.

ReadSymbol(IBsonReader, string)

Reads a BSON symbol element from the reader.

public static string ReadSymbol(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

string

A string.

ReadTimestamp(IBsonReader, string)

Reads a BSON timestamp element from the reader.

public static long ReadTimestamp(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.

Returns

long

The combined timestamp/increment.

ReadUndefined(IBsonReader, string)

Reads a BSON undefined element from the reader.

public static void ReadUndefined(this IBsonReader reader, string name)

Parameters

reader IBsonReader

The reader.

name string

The name of the element.