Table of Contents

Method SetOnInsert

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

SetOnInsert<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a set on insert operator.

public UpdateDefinition<TDocument> SetOnInsert<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A set on insert operator.

Type Parameters

TField

The type of the field.

SetOnInsert<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a set on insert operator.

public UpdateDefinition<TDocument> SetOnInsert<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A set on insert operator.

Type Parameters

TField

The type of the field.