Method Set

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

Set<TDocument, TField>(UpdateDefinition, FieldDefinition<TDocument, TField>, TField)

Combines an existing update with a set operator.

public static UpdateDefinition<TDocument> Set<TDocument, TField>(this UpdateDefinition<TDocument> update, FieldDefinition<TDocument, TField> field, TField value)

Parameters

update UpdateDefinition

The update.

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition

A combined update.

Type Parameters

TDocument

The type of the document.

TField

The type of the field.

Set<TDocument, TField>(UpdateDefinition, Expression<Func<TDocument, TField>>, TField)

Combines an existing update with a set operator.

public static UpdateDefinition<TDocument> Set<TDocument, TField>(this UpdateDefinition<TDocument> update, Expression<Func<TDocument, TField>> field, TField value)

Parameters

update UpdateDefinition

The update.

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition

A combined update.

Type Parameters

TDocument

The type of the document.

TField

The type of the field.