Table of Contents

Method AddToSet

Namespace
MongoDB.Driver.Builders
Assembly
MongoDB.Driver.Legacy.dll

AddToSet<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, TValue)

Adds a value to a named array element if the value is not already in the array (see $addToSet).

public static UpdateBuilder<TDocument> AddToSet<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, TValue value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression.

value TValue

The value to add to the set.

Returns

UpdateBuilder<TDocument>

The builder (so method calls can be chained).

Type Parameters

TValue

The type of the enumerable member values.