Table of Contents

Method Convert

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Convert<TFrom, TTo>(TFrom, ConvertOptions<TTo>)

Converts a value from one type to another using the $convert aggregation operator.

public static TTo Convert<TFrom, TTo>(TFrom value, ConvertOptions<TTo> options)

Parameters

value TFrom

The value to convert.

options ConvertOptions<TTo>

The conversion options.

Returns

TTo

The converted value.

Type Parameters

TFrom

The type of the input value.

TTo

The type of the output value.

Remarks

Not all conversions are supported by the $convert operator.