Method ReplaceOne
ReplaceOne(FilterDefinition<TDocument>, TDocument, ReplaceOptions, CancellationToken)
Replaces a single document.
ReplaceOneResult ReplaceOne(FilterDefinition<TDocument> filter, TDocument replacement, ReplaceOptions options = null, CancellationToken cancellationToken = default)
Parameters
filter
FilterDefinition <TDocument>The filter.
replacement
TDocumentThe replacement.
options
ReplaceOptions The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Replace
One Result The result of the replacement.
ReplaceOne(FilterDefinition<TDocument>, TDocument, UpdateOptions, CancellationToken)
Replaces a single document.
[Obsolete("Use the overload that takes a ReplaceOptions instead of an UpdateOptions.")]
ReplaceOneResult ReplaceOne(FilterDefinition<TDocument> filter, TDocument replacement, UpdateOptions options, CancellationToken cancellationToken = default)
Parameters
filter
FilterDefinition <TDocument>The filter.
replacement
TDocumentThe replacement.
options
UpdateOptions The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Replace
One Result The result of the replacement.
ReplaceOne(IClientSessionHandle, FilterDefinition<TDocument>, TDocument, ReplaceOptions, CancellationToken)
Replaces a single document.
ReplaceOneResult ReplaceOne(IClientSessionHandle session, FilterDefinition<TDocument> filter, TDocument replacement, ReplaceOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSession Handle The session.
filter
FilterDefinition <TDocument>The filter.
replacement
TDocumentThe replacement.
options
ReplaceOptions The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Replace
One Result The result of the replacement.
ReplaceOne(IClientSessionHandle, FilterDefinition<TDocument>, TDocument, UpdateOptions, CancellationToken)
Replaces a single document.
[Obsolete("Use the overload that takes a ReplaceOptions instead of an UpdateOptions.")]
ReplaceOneResult ReplaceOne(IClientSessionHandle session, FilterDefinition<TDocument> filter, TDocument replacement, UpdateOptions options, CancellationToken cancellationToken = default)
Parameters
session
IClientSession Handle The session.
filter
FilterDefinition <TDocument>The filter.
replacement
TDocumentThe replacement.
options
UpdateOptions The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Replace
One Result The result of the replacement.