Table of Contents

Method MapToBsonValue

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

MapToBsonValue(object)

Maps an object to an instance of the closest BsonValue class.

public static BsonValue MapToBsonValue(object value)

Parameters

value object

An object.

Returns

BsonValue

A BsonValue.

MapToBsonValue(object, BsonType)

Maps an object to a specific BsonValue type.

public static BsonValue MapToBsonValue(object value, BsonType bsonType)

Parameters

value object

An object.

bsonType BsonType

The BsonType to map to.

Returns

BsonValue

A BsonValue of the desired type (or BsonNull.Value if value is null and bsonType is Null).