Click or drag to resize

IMongoCollection<TDocument>.UpdateOneAsync Method (IClientSessionHandle, FilterDefinition<TDocument>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates a single document.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.16.0+eeafbea0921243a5868b81984e1083a07c1f75bc
Syntax
Task<UpdateResult> UpdateOneAsync(
	IClientSessionHandle session,
	FilterDefinition<TDocument> filter,
	UpdateDefinition<TDocument> update,
	UpdateOptions options = null,
	CancellationToken cancellationToken = default
)

Parameters

session
Type: MongoDB.Driver.IClientSessionHandle
The session.
filter
Type: MongoDB.Driver.FilterDefinition<TDocument>
The filter.
update
Type: MongoDB.Driver.UpdateDefinition<TDocument>
The update.
options (Optional)
Type: MongoDB.Driver.UpdateOptions
The options.
cancellationToken (Optional)
Type: System.Threading.CancellationToken
The cancellation token.

Return Value

Type: Task<UpdateResult>
The result of the update operation.
See Also