Table of Contents

Method InsertOne

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

InsertOne(TDocument, InsertOneOptions, CancellationToken)

Inserts a single document.

public virtual void InsertOne(TDocument document, InsertOneOptions options = null, CancellationToken cancellationToken = default)

Parameters

document TDocument

The document.

options InsertOneOptions

The options.

cancellationToken CancellationToken

The cancellation token.

InsertOne(IClientSessionHandle, TDocument, InsertOneOptions, CancellationToken)

Inserts a single document.

public virtual void InsertOne(IClientSessionHandle session, TDocument document, InsertOneOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

document TDocument

The document.

options InsertOneOptions

The options.

cancellationToken CancellationToken

The cancellation token.