Table of Contents

Method DeleteOneAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

DeleteOneAsync(FilterDefinition<TDocument>, CancellationToken)

Deletes a single document.

Task<DeleteResult> DeleteOneAsync(FilterDefinition<TDocument> filter, CancellationToken cancellationToken = default)

Parameters

filter FilterDefinition<TDocument>

The filter.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<DeleteResult>

The result of the delete operation.

DeleteOneAsync(FilterDefinition<TDocument>, DeleteOptions, CancellationToken)

Deletes a single document.

Task<DeleteResult> DeleteOneAsync(FilterDefinition<TDocument> filter, DeleteOptions options, CancellationToken cancellationToken = default)

Parameters

filter FilterDefinition<TDocument>

The filter.

options DeleteOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<DeleteResult>

The result of the delete operation.

DeleteOneAsync(IClientSessionHandle, FilterDefinition<TDocument>, DeleteOptions, CancellationToken)

Deletes a single document.

Task<DeleteResult> DeleteOneAsync(IClientSessionHandle session, FilterDefinition<TDocument> filter, DeleteOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

filter FilterDefinition<TDocument>

The filter.

options DeleteOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<DeleteResult>

The result of the delete operation.