Click or drag to resize

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

Replaces a single document.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.6.0+Branch.origin/v2.6.x.Sha.593796a7b35dc59243383bcc684de296a5468f2e
Syntax
Task<ReplaceOneResult> ReplaceOneAsync(
	IClientSessionHandle session,
	FilterDefinition<TDocument> filter,
	TDocument replacement,
	UpdateOptions options = null,
	CancellationToken cancellationToken = null
)

Parameters

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

Return Value

Type: Task<ReplaceOneResult>
The result of the replacement.
See Also