Method AddToSet
AddToSet<TDocument, TItem>(UpdateDefinition<TDocument>, FieldDefinition<TDocument>, TItem)
Combines an existing update with an add to set operator.
public static UpdateDefinition<TDocument> AddToSet<TDocument, TItem>(this UpdateDefinition<TDocument> update, FieldDefinition<TDocument> field, TItem value)
Parameters
updateUpdateDefinition<TDocument>The update.
fieldFieldDefinition<TDocument>The field.
valueTItemThe value.
Returns
- UpdateDefinition<TDocument>
A combined update.
Type Parameters
TDocumentThe type of the document.
TItemThe type of the item.
AddToSet<TDocument, TItem>(UpdateDefinition<TDocument>, Expression<Func<TDocument, IEnumerable<TItem>>>, TItem)
Combines an existing update with an add to set operator.
public static UpdateDefinition<TDocument> AddToSet<TDocument, TItem>(this UpdateDefinition<TDocument> update, Expression<Func<TDocument, IEnumerable<TItem>>> field, TItem value)
Parameters
updateUpdateDefinition<TDocument>The update.
fieldExpression<Func<TDocument, IEnumerable<TItem>>>The field.
valueTItemThe value.
Returns
- UpdateDefinition<TDocument>
A combined update.
Type Parameters
TDocumentThe type of the document.
TItemThe type of the item.