Method InsertOneAsync
InsertOneAsync(TDocument, CancellationToken)
Inserts a single document.
[Obsolete("Use the new overload of InsertOneAsync with an InsertOneOptions parameter instead.")]
Task InsertOneAsync(TDocument document, CancellationToken _cancellationToken)
Parameters
document
TDocumentThe document.
_cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
The result of the insert operation.
InsertOneAsync(TDocument, InsertOneOptions, CancellationToken)
Inserts a single document.
Task InsertOneAsync(TDocument document, InsertOneOptions options = null, CancellationToken cancellationToken = default)
Parameters
document
TDocumentThe document.
options
InsertOneOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
The result of the insert operation.
InsertOneAsync(IClientSessionHandle, TDocument, InsertOneOptions, CancellationToken)
Inserts a single document.
Task InsertOneAsync(IClientSessionHandle session, TDocument document, InsertOneOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
document
TDocumentThe document.
options
InsertOneOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
The result of the insert operation.