Method UpdateOneAsync
UpdateOneAsync(FilterDefinition<TDocument>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)
Updates a single document.
public virtual Task<UpdateResult> UpdateOneAsync(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
- Task<Update
Result > The result of the update operation.
UpdateOneAsync(IClientSessionHandle, FilterDefinition<TDocument>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)
Updates a single document.
public virtual Task<UpdateResult> UpdateOneAsync(IClientSessionHandle session, FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, UpdateOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSession Handle The session.
filter
FilterDefinition <TDocument>The filter.
update
UpdateDefinition <TDocument>The update.
options
UpdateOptions The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Task<Update
Result > The result of the update operation.