Method SetOnInsert
SetOnInsert<TDocument, TField>(UpdateDefinition<TDocument>, FieldDefinition<TDocument, TField>, TField)
Combines an existing update with a set on insert operator.
public static UpdateDefinition<TDocument> SetOnInsert<TDocument, TField>(this UpdateDefinition<TDocument> update, FieldDefinition<TDocument, TField> field, TField value)
Parameters
update
UpdateDefinition<TDocument>The update.
field
FieldDefinition<TDocument, TField>The field.
value
TFieldThe value.
Returns
- UpdateDefinition<TDocument>
A combined update.
Type Parameters
TDocument
The type of the document.
TField
The type of the field.
SetOnInsert<TDocument, TField>(UpdateDefinition<TDocument>, Expression<Func<TDocument, TField>>, TField)
Combines an existing update with a set on insert operator.
public static UpdateDefinition<TDocument> SetOnInsert<TDocument, TField>(this UpdateDefinition<TDocument> update, Expression<Func<TDocument, TField>> field, TField value)
Parameters
update
UpdateDefinition<TDocument>The update.
field
Expression<Func<TDocument, TField>>The field.
value
TFieldThe value.
Returns
- UpdateDefinition<TDocument>
A combined update.
Type Parameters
TDocument
The type of the document.
TField
The type of the field.