Class Update
A builder for creating update modifiers.
public static class Update
- Inheritance
-
Update
- Inherited Members
Methods
AddToSet(string, BsonValue)
Adds a value to a named array element if the value is not already in the array (see $addToSet).
public static UpdateBuilder AddToSet(string name, BsonValue value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
AddToSetEach(string, BsonArray)
Adds a list of values to a named array element adding each value only if it not already in the array (see $addToSet and $each).
public static UpdateBuilder AddToSetEach(string name, BsonArray values)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
AddToSetEach(string, params BsonValue[])
Adds a list of values to a named array element adding each value only if it not already in the array (see $addToSet and $each).
public static UpdateBuilder AddToSetEach(string name, params BsonValue[] values)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
AddToSetEach(string, IEnumerable<BsonValue>)
Adds a list of values to a named array element adding each value only if it not already in the array (see $addToSet and $each).
public static UpdateBuilder AddToSetEach(string name, IEnumerable<BsonValue> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<BsonValue>The values to add to the set.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
AddToSetEachWrapped<T>(string, IEnumerable<T>)
Adds a list of wrapped values to a named array element adding each value only if it not already in the array (see $addToSet and $each).
public static UpdateBuilder AddToSetEachWrapped<T>(string name, IEnumerable<T> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<T>The wrapped values to add to the set.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped values.
AddToSetEachWrapped<T>(string, params T[])
Adds a list of wrapped values to a named array element adding each value only if it not already in the array (see $addToSet and $each).
public static UpdateBuilder AddToSetEachWrapped<T>(string name, params T[] values)
Parameters
name
stringThe name of the array element.
values
T[]The wrapped values to add to the set.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped values.
AddToSetWrapped<T>(string, T)
Adds a wrapped value to a named array element if the value is not already in the array (see $addToSet).
public static UpdateBuilder AddToSetWrapped<T>(string name, T value)
Parameters
name
stringThe name of the array element.
value
TThe wrapped value to add to the set.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
BitwiseAnd(string, int)
Sets the named element to the bitwise and of its value with another value (see $bit with "and").
public static UpdateBuilder BitwiseAnd(string name, int value)
Parameters
name
stringThe name of the element to be modified.
value
intThe value to be and-ed with the current value.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
BitwiseAnd(string, long)
Sets the named element to the bitwise and of its value with another value (see $bit with "and").
public static UpdateBuilder BitwiseAnd(string name, long value)
Parameters
name
stringThe name of the element to be modified.
value
longThe value to be and-ed with the current value.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
BitwiseOr(string, int)
Sets the named element to the bitwise or of its value with another value (see $bit with "or").
public static UpdateBuilder BitwiseOr(string name, int value)
Parameters
name
stringThe name of the element to be modified.
value
intThe value to be or-ed with the current value.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
BitwiseOr(string, long)
Sets the named element to the bitwise or of its value with another value (see $bit with "or").
public static UpdateBuilder BitwiseOr(string name, long value)
Parameters
name
stringThe name of the element to be modified.
value
longThe value to be or-ed with the current value.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
BitwiseXor(string, int)
Sets the named element to the bitwise xor of its value with another value (see $bit with "xor").
public static UpdateBuilder BitwiseXor(string name, int value)
Parameters
name
stringThe name of the element to be modified.
value
intThe value to be xor-ed with the current value.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
BitwiseXor(string, long)
Sets the named element to the bitwise xor of its value with another value (see $bit with "xor").
public static UpdateBuilder BitwiseXor(string name, long value)
Parameters
name
stringThe name of the element to be modified.
value
longThe value to be xor-ed with the current value.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Combine(params IMongoUpdate[])
Combines several UpdateBuilders into a single UpdateBuilder.
public static UpdateBuilder Combine(params IMongoUpdate[] updates)
Parameters
updates
IMongoUpdate[]The UpdateBuilders to combine.
Returns
- UpdateBuilder
A combined UpdateBuilder.
Combine(IEnumerable<IMongoUpdate>)
Combines several UpdateBuilders into a single UpdateBuilder.
public static UpdateBuilder Combine(IEnumerable<IMongoUpdate> updates)
Parameters
updates
IEnumerable<IMongoUpdate>The UpdateBuilders to combine.
Returns
- UpdateBuilder
A combined UpdateBuilder.
CurrentDate(string)
Sets the value of the named element to the current date (see $currentDate).
public static UpdateBuilder CurrentDate(string name)
Parameters
name
stringThe name of the element.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
CurrentDate(string, UpdateCurrentDateType)
Sets the value of the named element to the current date (see $currentDate).
public static UpdateBuilder CurrentDate(string name, UpdateCurrentDateType type)
Parameters
name
stringThe name of the element.
type
UpdateCurrentDateTypeThe type to use.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Inc(string, double)
Increments the named element by a value (see $inc).
public static UpdateBuilder Inc(string name, double value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Inc(string, int)
Increments the named element by a value (see $inc).
public static UpdateBuilder Inc(string name, int value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Inc(string, long)
Increments the named element by a value (see $inc).
public static UpdateBuilder Inc(string name, long value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Max(string, BsonValue)
Updates the named element if and only if the provided value is greater than its current value (see $max).
public static UpdateBuilder Max(string name, BsonValue value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Min(string, BsonValue)
Updates the named element if and only if the provided value is less than its current value (see $max).
public static UpdateBuilder Min(string name, BsonValue value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Mul(string, double)
Multiplies the named element by a value (see $mul).
public static UpdateBuilder Mul(string name, double value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Mul(string, int)
Multiplies the named element by a value (see $mul).
public static UpdateBuilder Mul(string name, int value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Mul(string, long)
Multiplies the named element by a value (see $mul).
public static UpdateBuilder Mul(string name, long value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PopFirst(string)
Removes the first value from the named array element (see $pop).
public static UpdateBuilder PopFirst(string name)
Parameters
name
stringThe name of the array element.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PopLast(string)
Removes the last value from the named array element (see $pop).
public static UpdateBuilder PopLast(string name)
Parameters
name
stringThe name of the array element.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Pull(string, BsonValue)
Removes all values from the named array element that are equal to some value (see $pull).
public static UpdateBuilder Pull(string name, BsonValue value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Pull(string, IMongoQuery)
Removes all values from the named array element that match some query (see $pull).
public static UpdateBuilder Pull(string name, IMongoQuery query)
Parameters
name
stringThe name of the array element.
query
IMongoQueryA query that specifies which elements to remove.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PullAll(string, BsonArray)
Removes all values from the named array element that are equal to any of a list of values (see $pullAll).
public static UpdateBuilder PullAll(string name, BsonArray values)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PullAll(string, params BsonValue[])
Removes all values from the named array element that are equal to any of a list of values (see $pullAll).
public static UpdateBuilder PullAll(string name, params BsonValue[] values)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PullAll(string, IEnumerable<BsonValue>)
Removes all values from the named array element that are equal to any of a list of values (see $pullAll).
public static UpdateBuilder PullAll(string name, IEnumerable<BsonValue> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<BsonValue>The values to remove.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PullAllWrapped<T>(string, IEnumerable<T>)
Removes all values from the named array element that are equal to any of a list of wrapped values (see $pullAll).
public static UpdateBuilder PullAllWrapped<T>(string name, IEnumerable<T> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<T>The wrapped values to remove.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped values.
PullAllWrapped<T>(string, params T[])
Removes all values from the named array element that are equal to any of a list of wrapped values (see $pullAll).
public static UpdateBuilder PullAllWrapped<T>(string name, params T[] values)
Parameters
name
stringThe name of the array element.
values
T[]The wrapped values to remove.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped values.
PullWrapped<T>(string, T)
Removes all values from the named array element that are equal to some wrapped value (see $pull).
public static UpdateBuilder PullWrapped<T>(string name, T value)
Parameters
name
stringThe name of the array element.
value
TThe wrapped value to remove.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
Push(string, BsonValue)
Adds a value to the end of the named array element (see $push).
public static UpdateBuilder Push(string name, BsonValue value)
Parameters
name
stringThe name of the array element.
value
BsonValueThe value to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushAll(string, BsonArray)
Adds a list of values to the end of the named array element (see $pushAll).
public static UpdateBuilder PushAll(string name, BsonArray values)
Parameters
name
stringThe name of the array element.
values
BsonArrayThe values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushAll(string, params BsonValue[])
Adds a list of values to the end of the named array element (see $pushAll).
public static UpdateBuilder PushAll(string name, params BsonValue[] values)
Parameters
name
stringThe name of the array element.
values
BsonValue[]The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushAll(string, IEnumerable<BsonValue>)
Adds a list of values to the end of the named array element (see $pushAll).
public static UpdateBuilder PushAll(string name, IEnumerable<BsonValue> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<BsonValue>The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushAllWrapped<T>(string, IEnumerable<T>)
Adds a list of wrapped values to the end of the named array element (see $pushAll).
public static UpdateBuilder PushAllWrapped<T>(string name, IEnumerable<T> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<T>The wrapped values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped values.
PushAllWrapped<T>(string, params T[])
Adds a list of wrapped values to the end of the named array element (see $pushAll).
public static UpdateBuilder PushAllWrapped<T>(string name, params T[] values)
Parameters
name
stringThe name of the array element.
values
T[]The wrapped values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped values.
PushEach(string, BsonArray)
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEach(string name, BsonArray values)
Parameters
name
stringThe name of the array element.
values
BsonArrayThe values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushEach(string, params BsonValue[])
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEach(string name, params BsonValue[] values)
Parameters
name
stringThe name of the array element.
values
BsonValue[]The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushEach(string, PushEachOptions, BsonArray)
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEach(string name, PushEachOptions options, BsonArray values)
Parameters
name
stringThe name of the array element.
options
PushEachOptionsThe options.
values
BsonArrayThe values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushEach(string, PushEachOptions, params BsonValue[])
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEach(string name, PushEachOptions options, params BsonValue[] values)
Parameters
name
stringThe name of the array element.
options
PushEachOptionsThe options.
values
BsonValue[]The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushEach(string, PushEachOptions, IEnumerable<BsonValue>)
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEach(string name, PushEachOptions options, IEnumerable<BsonValue> values)
Parameters
name
stringThe name of the array element.
options
PushEachOptionsThe options.
values
IEnumerable<BsonValue>The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushEach(string, IEnumerable<BsonValue>)
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEach(string name, IEnumerable<BsonValue> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<BsonValue>The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
PushEachWrapped<T>(string, PushEachOptions, IEnumerable<T>)
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEachWrapped<T>(string name, PushEachOptions options, IEnumerable<T> values)
Parameters
name
stringThe name of the array element.
options
PushEachOptionsThe options.
values
IEnumerable<T>The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
PushEachWrapped<T>(string, PushEachOptions, params T[])
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEachWrapped<T>(string name, PushEachOptions options, params T[] values)
Parameters
name
stringThe name of the array element.
options
PushEachOptionsThe options.
values
T[]The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
PushEachWrapped<T>(string, IEnumerable<T>)
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEachWrapped<T>(string name, IEnumerable<T> values)
Parameters
name
stringThe name of the array element.
values
IEnumerable<T>The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
PushEachWrapped<T>(string, params T[])
Adds a list of values to the end of the named array element (see $push and $each).
public static UpdateBuilder PushEachWrapped<T>(string name, params T[] values)
Parameters
name
stringThe name of the array element.
values
T[]The values to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
PushWrapped<T>(string, T)
Adds a wrapped value to the end of the named array element (see $push).
public static UpdateBuilder PushWrapped<T>(string name, T value)
Parameters
name
stringThe name of the array element.
value
TThe wrapped value to add to the end of the array.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
Rename(string, string)
Renames an element (see $rename).
public static UpdateBuilder Rename(string oldElementName, string newElementName)
Parameters
oldElementName
stringThe name of the element to be renamed.
newElementName
stringThe new name of the element.
Returns
- UpdateBuilder
An UpdateDocuemnt.
Replace(Type, object)
Replaces the entire document with a new document (the _id must remain the same).
public static IMongoUpdate Replace(Type nominalType, object document)
Parameters
nominalType
TypeThe nominal type of the replacement document
document
objectThe replacement document.
Returns
- IMongoUpdate
An UpdateWrapper.
Replace<TNominalType>(TNominalType)
Replaces the entire document with a new document (the _id must remain the same).
public static IMongoUpdate Replace<TNominalType>(TNominalType document)
Parameters
document
TNominalTypeThe replacement document.
Returns
- IMongoUpdate
An UpdateWrapper.
Type Parameters
TNominalType
The nominal type of the replacement document
Set(string, BsonValue)
Sets the value of the named element to a new value (see $set).
public static UpdateBuilder Set(string name, BsonValue value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
SetOnInsert(string, BsonValue)
Sets the value of the named element to the specified value only when an insert occurs as part of an upsert operation (see $setOnInsert).
public static UpdateBuilder SetOnInsert(string name, BsonValue value)
Parameters
Returns
- UpdateBuilder
The builder (so method calls can be chained).
SetWrapped<T>(string, T)
Sets the value of the named element to a new wrapped value (see $set).
public static UpdateBuilder SetWrapped<T>(string name, T value)
Parameters
name
stringThe name of the element to be set.
value
TThe new wrapped value.
Returns
- UpdateBuilder
The builder (so method calls can be chained).
Type Parameters
T
The type of wrapped value.
Unset(string)
Removes the named element from the document (see $unset).
public static UpdateBuilder Unset(string name)
Parameters
name
stringThe name of the element to be removed.
Returns
- UpdateBuilder
The builder (so method calls can be chained).