Table of Contents

Interface IMongoDatabase

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Represents a database in MongoDB.

public interface IMongoDatabase
Extension Methods

Remarks

This interface is not guaranteed to remain stable. Implementors should use MongoDatabaseBase.

Properties

Client

Gets the client.

IMongoClient Client { get; }

Property Value

IMongoClient

DatabaseNamespace

Gets the namespace of the database.

DatabaseNamespace DatabaseNamespace { get; }

Property Value

DatabaseNamespace

Settings

Gets the settings.

MongoDatabaseSettings Settings { get; }

Property Value

MongoDatabaseSettings

Methods

AggregateAsync<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

Task<IAsyncCursor<TResult>> AggregateAsync<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<TResult>>

A Task whose result is a cursor.

Type Parameters

TResult

The type of the result.

AggregateAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

Task<IAsyncCursor<TResult>> AggregateAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<TResult>>

A Task whose result is a cursor.

Type Parameters

TResult

The type of the result.

AggregateToCollectionAsync<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

Task AggregateToCollectionAsync<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task.

Type Parameters

TResult

The type of the result.

AggregateToCollectionAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

Task AggregateToCollectionAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task.

Type Parameters

TResult

The type of the result.

AggregateToCollection<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

void AggregateToCollection<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Type Parameters

TResult

The type of the result.

AggregateToCollection<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

void AggregateToCollection<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Type Parameters

TResult

The type of the result.

Aggregate<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

IAsyncCursor<TResult> Aggregate<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<TResult>

A cursor.

Type Parameters

TResult

The type of the result.

Aggregate<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)

Runs an aggregation pipeline.

IAsyncCursor<TResult> Aggregate<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<NoPipelineInput, TResult>

The pipeline.

options AggregateOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<TResult>

A cursor.

Type Parameters

TResult

The type of the result.

CreateCollection(IClientSessionHandle, string, CreateCollectionOptions, CancellationToken)

Creates the collection with the specified name.

void CreateCollection(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.

CreateCollection(string, CreateCollectionOptions, CancellationToken)

Creates the collection with the specified name.

void CreateCollection(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default)

Parameters

name string

The name.

options CreateCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

CreateCollectionAsync(IClientSessionHandle, string, CreateCollectionOptions, CancellationToken)

Creates the collection with the specified name.

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.

CreateCollectionAsync(string, CreateCollectionOptions, CancellationToken)

Creates the collection with the specified name.

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.

CreateViewAsync<TDocument, TResult>(IClientSessionHandle, string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)

Creates a view.

Task CreateViewAsync<TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

viewName string

The name of the view.

viewOn string

The name of the collection that the view is on.

pipeline PipelineDefinition<TDocument, TResult>

The pipeline.

options CreateViewOptions<TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

Type Parameters

TDocument

The type of the input documents.

TResult

The type of the pipeline result documents.

CreateViewAsync<TDocument, TResult>(string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)

Creates a view.

Task CreateViewAsync<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

viewName string

The name of the view.

viewOn string

The name of the collection that the view is on.

pipeline PipelineDefinition<TDocument, TResult>

The pipeline.

options CreateViewOptions<TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

Type Parameters

TDocument

The type of the input documents.

TResult

The type of the pipeline result documents.

CreateView<TDocument, TResult>(IClientSessionHandle, string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)

Creates a view.

void CreateView<TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

viewName string

The name of the view.

viewOn string

The name of the collection that the view is on.

pipeline PipelineDefinition<TDocument, TResult>

The pipeline.

options CreateViewOptions<TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Type Parameters

TDocument

The type of the input documents.

TResult

The type of the pipeline result documents.

CreateView<TDocument, TResult>(string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)

Creates a view.

void CreateView<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

viewName string

The name of the view.

viewOn string

The name of the collection that the view is on.

pipeline PipelineDefinition<TDocument, TResult>

The pipeline.

options CreateViewOptions<TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Type Parameters

TDocument

The type of the input documents.

TResult

The type of the pipeline result documents.

DropCollection(IClientSessionHandle, string, DropCollectionOptions, CancellationToken)

Drops the collection with the specified name.

void DropCollection(IClientSessionHandle session, string name, DropCollectionOptions options, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

name string

The name of the collection to drop.

options DropCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

DropCollection(IClientSessionHandle, string, CancellationToken)

Drops the collection with the specified name.

void DropCollection(IClientSessionHandle session, string name, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

name string

The name of the collection to drop.

cancellationToken CancellationToken

The cancellation token.

DropCollection(string, DropCollectionOptions, CancellationToken)

Drops the collection with the specified name.

void DropCollection(string name, DropCollectionOptions options, CancellationToken cancellationToken = default)

Parameters

name string

The name of the collection to drop.

options DropCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

DropCollection(string, CancellationToken)

Drops the collection with the specified name.

void DropCollection(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the collection to drop.

cancellationToken CancellationToken

The cancellation token.

DropCollectionAsync(IClientSessionHandle, string, DropCollectionOptions, CancellationToken)

Drops the collection with the specified name.

Task DropCollectionAsync(IClientSessionHandle session, string name, DropCollectionOptions options, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

name string

The name of the collection to drop.

options DropCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

DropCollectionAsync(IClientSessionHandle, string, CancellationToken)

Drops the collection with the specified name.

Task DropCollectionAsync(IClientSessionHandle session, string name, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

name string

The name of the collection to drop.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

DropCollectionAsync(string, DropCollectionOptions, CancellationToken)

Drops the collection with the specified name.

Task DropCollectionAsync(string name, DropCollectionOptions options, CancellationToken cancellationToken = default)

Parameters

name string

The name of the collection to drop.

options DropCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

DropCollectionAsync(string, CancellationToken)

Drops the collection with the specified name.

Task DropCollectionAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the collection to drop.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

GetCollection<TDocument>(string, MongoCollectionSettings)

Gets a collection.

IMongoCollection<TDocument> GetCollection<TDocument>(string name, MongoCollectionSettings settings = null)

Parameters

name string

The name of the collection.

settings MongoCollectionSettings

The settings.

Returns

IMongoCollection<TDocument>

An implementation of a collection.

Type Parameters

TDocument

The document type.

ListCollectionNames(IClientSessionHandle, ListCollectionNamesOptions, CancellationToken)

Lists the names of all the collections in the database.

IAsyncCursor<string> ListCollectionNames(IClientSessionHandle session, ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

options ListCollectionNamesOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<string>

A cursor.

ListCollectionNames(ListCollectionNamesOptions, CancellationToken)

Lists the names of all the collections in the database.

IAsyncCursor<string> ListCollectionNames(ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)

Parameters

options ListCollectionNamesOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<string>

A cursor.

ListCollectionNamesAsync(IClientSessionHandle, ListCollectionNamesOptions, CancellationToken)

Lists the names of all the collections in the database.

Task<IAsyncCursor<string>> ListCollectionNamesAsync(IClientSessionHandle session, ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

options ListCollectionNamesOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<string>>

A Task whose result is a cursor.

ListCollectionNamesAsync(ListCollectionNamesOptions, CancellationToken)

Lists the names of all the collections in the database.

Task<IAsyncCursor<string>> ListCollectionNamesAsync(ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)

Parameters

options ListCollectionNamesOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<string>>

A Task whose result is a cursor.

ListCollections(IClientSessionHandle, ListCollectionsOptions, CancellationToken)

Lists all the collections in the database.

IAsyncCursor<BsonDocument> ListCollections(IClientSessionHandle session, ListCollectionsOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

options ListCollectionsOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<BsonDocument>

A cursor.

ListCollections(ListCollectionsOptions, CancellationToken)

Lists all the collections in the database.

IAsyncCursor<BsonDocument> ListCollections(ListCollectionsOptions options = null, CancellationToken cancellationToken = default)

Parameters

options ListCollectionsOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<BsonDocument>

A cursor.

ListCollectionsAsync(IClientSessionHandle, ListCollectionsOptions, CancellationToken)

Lists all the collections in the database.

Task<IAsyncCursor<BsonDocument>> ListCollectionsAsync(IClientSessionHandle session, ListCollectionsOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

options ListCollectionsOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<BsonDocument>>

A Task whose result is a cursor.

ListCollectionsAsync(ListCollectionsOptions, CancellationToken)

Lists all the collections in the database.

Task<IAsyncCursor<BsonDocument>> ListCollectionsAsync(ListCollectionsOptions options = null, CancellationToken cancellationToken = default)

Parameters

options ListCollectionsOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<BsonDocument>>

A Task whose result is a cursor.

RenameCollection(IClientSessionHandle, string, string, RenameCollectionOptions, CancellationToken)

Renames the collection.

void RenameCollection(IClientSessionHandle session, string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

oldName string

The old name.

newName string

The new name.

options RenameCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

RenameCollection(string, string, RenameCollectionOptions, CancellationToken)

Renames the collection.

void RenameCollection(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)

Parameters

oldName string

The old name.

newName string

The new name.

options RenameCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

RenameCollectionAsync(IClientSessionHandle, string, string, RenameCollectionOptions, CancellationToken)

Renames the collection.

Task RenameCollectionAsync(IClientSessionHandle session, string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

oldName string

The old name.

newName string

The new name.

options RenameCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

RenameCollectionAsync(string, string, RenameCollectionOptions, CancellationToken)

Renames the collection.

Task RenameCollectionAsync(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)

Parameters

oldName string

The old name.

newName string

The new name.

options RenameCollectionOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

RunCommandAsync<TResult>(Command<TResult>, ReadPreference, CancellationToken)

Runs a command.

Task<TResult> RunCommandAsync<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)

Parameters

command Command<TResult>

The command.

readPreference ReadPreference

The read preference.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TResult>

The result of the command.

Type Parameters

TResult

The result type of the command.

RunCommandAsync<TResult>(IClientSessionHandle, Command<TResult>, ReadPreference, CancellationToken)

Runs a command.

Task<TResult> RunCommandAsync<TResult>(IClientSessionHandle session, Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

command Command<TResult>

The command.

readPreference ReadPreference

The read preference.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TResult>

The result of the command.

Type Parameters

TResult

The result type of the command.

RunCommand<TResult>(Command<TResult>, ReadPreference, CancellationToken)

Runs a command.

TResult RunCommand<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)

Parameters

command Command<TResult>

The command.

readPreference ReadPreference

The read preference.

cancellationToken CancellationToken

The cancellation token.

Returns

TResult

The result of the command.

Type Parameters

TResult

The result type of the command.

RunCommand<TResult>(IClientSessionHandle, Command<TResult>, ReadPreference, CancellationToken)

Runs a command.

TResult RunCommand<TResult>(IClientSessionHandle session, Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

command Command<TResult>

The command.

readPreference ReadPreference

The read preference.

cancellationToken CancellationToken

The cancellation token.

Returns

TResult

The result of the command.

Type Parameters

TResult

The result type of the command.

WatchAsync<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in a database.

Task<IChangeStreamCursor<TResult>> WatchAsync<TResult>(IClientSessionHandle session, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<TResult>>

A change stream.

Type Parameters

TResult

The type of the result.

WatchAsync<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in a database.

Task<IChangeStreamCursor<TResult>> WatchAsync<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<TResult>>

A change stream.

Type Parameters

TResult

The type of the result.

Watch<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in a database.

IChangeStreamCursor<TResult> Watch<TResult>(IClientSessionHandle session, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<TResult>

A change stream.

Type Parameters

TResult

The type of the result.

Watch<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in a database.

IChangeStreamCursor<TResult> Watch<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<TResult>

A change stream.

Type Parameters

TResult

The type of the result.

WithReadConcern(ReadConcern)

Returns a new IMongoDatabase instance with a different read concern setting.

IMongoDatabase WithReadConcern(ReadConcern readConcern)

Parameters

readConcern ReadConcern

The read concern.

Returns

IMongoDatabase

A new IMongoDatabase instance with a different read concern setting.

WithReadPreference(ReadPreference)

Returns a new IMongoDatabase instance with a different read preference setting.

IMongoDatabase WithReadPreference(ReadPreference readPreference)

Parameters

readPreference ReadPreference

The read preference.

Returns

IMongoDatabase

A new IMongoDatabase instance with a different read preference setting.

WithWriteConcern(WriteConcern)

Returns a new IMongoDatabase instance with a different write concern setting.

IMongoDatabase WithWriteConcern(WriteConcern writeConcern)

Parameters

writeConcern WriteConcern

The write concern.

Returns

IMongoDatabase

A new IMongoDatabase instance with a different write concern setting.