Table of Contents

Class UpdateDefinitionBuilder<TDocument>

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

A builder for an UpdateDefinition<TDocument>.

public sealed class UpdateDefinitionBuilder<TDocument>

Type Parameters

TDocument

The type of the document.

Inheritance
UpdateDefinitionBuilder<TDocument>
Inherited Members

Methods

AddToSetEach<TItem>(FieldDefinition<TDocument>, IEnumerable<TItem>)

Creates an add to set operator.

public UpdateDefinition<TDocument> AddToSetEach<TItem>(FieldDefinition<TDocument> field, IEnumerable<TItem> values)

Parameters

field FieldDefinition<TDocument>

The field.

values IEnumerable<TItem>

The values.

Returns

UpdateDefinition<TDocument>

An add to set operator.

Type Parameters

TItem

The type of the item.

AddToSetEach<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>>, IEnumerable<TItem>)

Creates an add to set operator.

public UpdateDefinition<TDocument> AddToSetEach<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, IEnumerable<TItem> values)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

values IEnumerable<TItem>

The values.

Returns

UpdateDefinition<TDocument>

An add to set operator.

Type Parameters

TItem

The type of the item.

AddToSet<TItem>(FieldDefinition<TDocument>, TItem)

Creates an add to set operator.

public UpdateDefinition<TDocument> AddToSet<TItem>(FieldDefinition<TDocument> field, TItem value)

Parameters

field FieldDefinition<TDocument>

The field.

value TItem

The value.

Returns

UpdateDefinition<TDocument>

An add to set operator.

Type Parameters

TItem

The type of the item.

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

Creates an add to set operator.

public UpdateDefinition<TDocument> AddToSet<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, TItem value)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

value TItem

The value.

Returns

UpdateDefinition<TDocument>

An add to set operator.

Type Parameters

TItem

The type of the item.

BitwiseAnd<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a bitwise and operator.

public UpdateDefinition<TDocument> BitwiseAnd<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A bitwise and operator.

Type Parameters

TField

The type of the field.

BitwiseAnd<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a bitwise and operator.

public UpdateDefinition<TDocument> BitwiseAnd<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A bitwise and operator.

Type Parameters

TField

The type of the field.

BitwiseOr<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a bitwise or operator.

public UpdateDefinition<TDocument> BitwiseOr<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A bitwise or operator.

Type Parameters

TField

The type of the field.

BitwiseOr<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a bitwise or operator.

public UpdateDefinition<TDocument> BitwiseOr<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A bitwise or operator.

Type Parameters

TField

The type of the field.

BitwiseXor<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a bitwise xor operator.

public UpdateDefinition<TDocument> BitwiseXor<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A bitwise xor operator.

Type Parameters

TField

The type of the field.

BitwiseXor<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a bitwise xor operator.

public UpdateDefinition<TDocument> BitwiseXor<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A bitwise xor operator.

Type Parameters

TField

The type of the field.

Combine(params UpdateDefinition<TDocument>[])

Creates a combined update.

public UpdateDefinition<TDocument> Combine(params UpdateDefinition<TDocument>[] updates)

Parameters

updates UpdateDefinition<TDocument>[]

The updates.

Returns

UpdateDefinition<TDocument>

A combined update.

Combine(IEnumerable<UpdateDefinition<TDocument>>)

Creates a combined update.

public UpdateDefinition<TDocument> Combine(IEnumerable<UpdateDefinition<TDocument>> updates)

Parameters

updates IEnumerable<UpdateDefinition<TDocument>>

The updates.

Returns

UpdateDefinition<TDocument>

A combined update.

CurrentDate(FieldDefinition<TDocument>, UpdateDefinitionCurrentDateType?)

Creates a current date operator.

public UpdateDefinition<TDocument> CurrentDate(FieldDefinition<TDocument> field, UpdateDefinitionCurrentDateType? type = null)

Parameters

field FieldDefinition<TDocument>

The field.

type UpdateDefinitionCurrentDateType?

The type.

Returns

UpdateDefinition<TDocument>

A current date operator.

CurrentDate(Expression<Func<TDocument, object>>, UpdateDefinitionCurrentDateType?)

Creates a current date operator.

public UpdateDefinition<TDocument> CurrentDate(Expression<Func<TDocument, object>> field, UpdateDefinitionCurrentDateType? type = null)

Parameters

field Expression<Func<TDocument, object>>

The field.

type UpdateDefinitionCurrentDateType?

The type.

Returns

UpdateDefinition<TDocument>

A current date operator.

Inc<TField>(FieldDefinition<TDocument, TField>, TField)

Creates an increment operator.

public UpdateDefinition<TDocument> Inc<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

An increment operator.

Type Parameters

TField

The type of the field.

Inc<TField>(Expression<Func<TDocument, TField>>, TField)

Creates an increment operator.

public UpdateDefinition<TDocument> Inc<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

An increment operator.

Type Parameters

TField

The type of the field.

Max<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a max operator.

public UpdateDefinition<TDocument> Max<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A max operator.

Type Parameters

TField

The type of the field.

Max<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a max operator.

public UpdateDefinition<TDocument> Max<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A max operator.

Type Parameters

TField

The type of the field.

Min<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a min operator.

public UpdateDefinition<TDocument> Min<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A min operator.

Type Parameters

TField

The type of the field.

Min<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a min operator.

public UpdateDefinition<TDocument> Min<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A min operator.

Type Parameters

TField

The type of the field.

Mul<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a multiply operator.

public UpdateDefinition<TDocument> Mul<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A multiply operator.

Type Parameters

TField

The type of the field.

Mul<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a multiply operator.

public UpdateDefinition<TDocument> Mul<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A multiply operator.

Type Parameters

TField

The type of the field.

Pipeline(PipelineDefinition<TDocument, TDocument>)

Creates an update pipeline.

public UpdateDefinition<TDocument> Pipeline(PipelineDefinition<TDocument, TDocument> pipeline)

Parameters

pipeline PipelineDefinition<TDocument, TDocument>

The pipeline.

Returns

UpdateDefinition<TDocument>

An update pipeline.

PopFirst(FieldDefinition<TDocument>)

Creates a pop operator.

public UpdateDefinition<TDocument> PopFirst(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

UpdateDefinition<TDocument>

A pop operator.

PopFirst(Expression<Func<TDocument, object>>)

Creates a pop first operator.

public UpdateDefinition<TDocument> PopFirst(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

UpdateDefinition<TDocument>

A pop first operator.

PopLast(FieldDefinition<TDocument>)

Creates a pop operator.

public UpdateDefinition<TDocument> PopLast(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

UpdateDefinition<TDocument>

A pop operator.

PopLast(Expression<Func<TDocument, object>>)

Creates a pop first operator.

public UpdateDefinition<TDocument> PopLast(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

UpdateDefinition<TDocument>

A pop last operator.

PullAll<TItem>(FieldDefinition<TDocument>, IEnumerable<TItem>)

Creates a pull operator.

public UpdateDefinition<TDocument> PullAll<TItem>(FieldDefinition<TDocument> field, IEnumerable<TItem> values)

Parameters

field FieldDefinition<TDocument>

The field.

values IEnumerable<TItem>

The values.

Returns

UpdateDefinition<TDocument>

A pull operator.

Type Parameters

TItem

The type of the item.

PullAll<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>>, IEnumerable<TItem>)

Creates a pull operator.

public UpdateDefinition<TDocument> PullAll<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, IEnumerable<TItem> values)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

values IEnumerable<TItem>

The values.

Returns

UpdateDefinition<TDocument>

A pull operator.

Type Parameters

TItem

The type of the item.

PullFilter<TItem>(FieldDefinition<TDocument>, FilterDefinition<TItem>)

Creates a pull operator.

public UpdateDefinition<TDocument> PullFilter<TItem>(FieldDefinition<TDocument> field, FilterDefinition<TItem> filter)

Parameters

field FieldDefinition<TDocument>

The field.

filter FilterDefinition<TItem>

The filter.

Returns

UpdateDefinition<TDocument>

A pull operator.

Type Parameters

TItem

The type of the item.

PullFilter<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>>, FilterDefinition<TItem>)

Creates a pull operator.

public UpdateDefinition<TDocument> PullFilter<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, FilterDefinition<TItem> filter)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

filter FilterDefinition<TItem>

The filter.

Returns

UpdateDefinition<TDocument>

A pull operator.

Type Parameters

TItem

The type of the item.

PullFilter<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>>, Expression<Func<TItem, bool>>)

Creates a pull operator.

public UpdateDefinition<TDocument> PullFilter<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, Expression<Func<TItem, bool>> filter)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

filter Expression<Func<TItem, bool>>

The filter.

Returns

UpdateDefinition<TDocument>

A pull operator.

Type Parameters

TItem

The type of the item.

Pull<TItem>(FieldDefinition<TDocument>, TItem)

Creates a pull operator.

public UpdateDefinition<TDocument> Pull<TItem>(FieldDefinition<TDocument> field, TItem value)

Parameters

field FieldDefinition<TDocument>

The field.

value TItem

The value.

Returns

UpdateDefinition<TDocument>

A pull operator.

Type Parameters

TItem

The type of the item.

Pull<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>>, TItem)

Creates a pull operator.

public UpdateDefinition<TDocument> Pull<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, TItem value)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

value TItem

The value.

Returns

UpdateDefinition<TDocument>

A pull operator.

Type Parameters

TItem

The type of the item.

PushEach<TItem>(FieldDefinition<TDocument>, IEnumerable<TItem>, int?, int?, SortDefinition<TItem>)

Creates a push operator.

public UpdateDefinition<TDocument> PushEach<TItem>(FieldDefinition<TDocument> field, IEnumerable<TItem> values, int? slice = null, int? position = null, SortDefinition<TItem> sort = null)

Parameters

field FieldDefinition<TDocument>

The field.

values IEnumerable<TItem>

The values.

slice int?

The slice.

position int?

The position.

sort SortDefinition<TItem>

The sort.

Returns

UpdateDefinition<TDocument>

A push operator.

Type Parameters

TItem

The type of the item.

PushEach<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>>, IEnumerable<TItem>, int?, int?, SortDefinition<TItem>)

Creates a push operator.

public UpdateDefinition<TDocument> PushEach<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, IEnumerable<TItem> values, int? slice = null, int? position = null, SortDefinition<TItem> sort = null)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

values IEnumerable<TItem>

The values.

slice int?

The slice.

position int?

The position.

sort SortDefinition<TItem>

The sort.

Returns

UpdateDefinition<TDocument>

A push operator.

Type Parameters

TItem

The type of the item.

Push<TItem>(FieldDefinition<TDocument>, TItem)

Creates a push operator.

public UpdateDefinition<TDocument> Push<TItem>(FieldDefinition<TDocument> field, TItem value)

Parameters

field FieldDefinition<TDocument>

The field.

value TItem

The value.

Returns

UpdateDefinition<TDocument>

A push operator.

Type Parameters

TItem

The type of the item.

Push<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>>, TItem)

Creates a push operator.

public UpdateDefinition<TDocument> Push<TItem>(Expression<Func<TDocument, IEnumerable<TItem>>> field, TItem value)

Parameters

field Expression<Func<TDocument, IEnumerable<TItem>>>

The field.

value TItem

The value.

Returns

UpdateDefinition<TDocument>

A push operator.

Type Parameters

TItem

The type of the item.

Rename(FieldDefinition<TDocument>, string)

Creates a field renaming operator.

public UpdateDefinition<TDocument> Rename(FieldDefinition<TDocument> field, string newName)

Parameters

field FieldDefinition<TDocument>

The field.

newName string

The new name.

Returns

UpdateDefinition<TDocument>

A field rename operator.

Rename(Expression<Func<TDocument, object>>, string)

Creates a field renaming operator.

public UpdateDefinition<TDocument> Rename(Expression<Func<TDocument, object>> field, string newName)

Parameters

field Expression<Func<TDocument, object>>

The field.

newName string

The new name.

Returns

UpdateDefinition<TDocument>

A field rename operator.

SetOnInsert<TField>(FieldDefinition<TDocument, TField>, TField)

Creates a set on insert operator.

public UpdateDefinition<TDocument> SetOnInsert<TField>(FieldDefinition<TDocument, TField> field, TField value)

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A set on insert operator.

Type Parameters

TField

The type of the field.

SetOnInsert<TField>(Expression<Func<TDocument, TField>>, TField)

Creates a set on insert operator.

public UpdateDefinition<TDocument> SetOnInsert<TField>(Expression<Func<TDocument, TField>> field, TField value)

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A set on insert operator.

Type Parameters

TField

The type of the field.

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

Creates a set operator.

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

Parameters

field FieldDefinition<TDocument, TField>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A set operator.

Type Parameters

TField

The type of the field.

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

Creates a set operator.

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

Parameters

field Expression<Func<TDocument, TField>>

The field.

value TField

The value.

Returns

UpdateDefinition<TDocument>

A set operator.

Type Parameters

TField

The type of the field.

Unset(FieldDefinition<TDocument>)

Creates an unset operator.

public UpdateDefinition<TDocument> Unset(FieldDefinition<TDocument> field)

Parameters

field FieldDefinition<TDocument>

The field.

Returns

UpdateDefinition<TDocument>

An unset operator.

Unset(Expression<Func<TDocument, object>>)

Creates an unset operator.

public UpdateDefinition<TDocument> Unset(Expression<Func<TDocument, object>> field)

Parameters

field Expression<Func<TDocument, object>>

The field.

Returns

UpdateDefinition<TDocument>

An unset operator.