Table of Contents

Method CreateCollectionAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

CreateCollectionAsync(string, CreateCollectionOptions, CancellationToken)

Creates the collection with the specified name.

public abstract Task CreateCollectionAsync(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default)

Parameters

name string

The name.

options CreateCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

CreateCollectionAsync(IClientSessionHandle, string, CreateCollectionOptions, CancellationToken)

Creates the collection with the specified name.

public virtual Task CreateCollectionAsync(IClientSessionHandle session, string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

name string

The name.

options CreateCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.