Table of Contents

Method UpdateOne

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

UpdateOne(FilterDefinition<TDocument>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates a single document.

public virtual UpdateResult UpdateOne(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, UpdateOptions options = null, CancellationToken cancellationToken = default)

Parameters

filter FilterDefinition<TDocument>

The filter.

update UpdateDefinition<TDocument>

The update.

options UpdateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

UpdateResult

The result of the update operation.

UpdateOne(IClientSessionHandle, FilterDefinition<TDocument>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates a single document.

public virtual UpdateResult UpdateOne(IClientSessionHandle session, FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, UpdateOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

filter FilterDefinition<TDocument>

The filter.

update UpdateDefinition<TDocument>

The update.

options UpdateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

UpdateResult

The result of the update operation.