Table of Contents

Class MongoClient

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Base class for implementors of IMongoClient.

public class MongoClient : MongoClientBase, IMongoClient
Inheritance
MongoClient
Implements
Inherited Members
Extension Methods

Constructors

MongoClient()

Initializes a new instance of the MongoClient class.

MongoClient(MongoClientSettings)

Initializes a new instance of the MongoClient class.

MongoClient(MongoUrl)

Initializes a new instance of the MongoClient class.

MongoClient(string)

Initializes a new instance of the MongoClient class.

Properties

Cluster

Gets the cluster.

Settings

Gets the settings.

Methods

DropDatabase(IClientSessionHandle, string, CancellationToken)

Drops the database with the specified name.

DropDatabase(string, CancellationToken)

Drops the database with the specified name.

DropDatabaseAsync(IClientSessionHandle, string, CancellationToken)

Drops the database with the specified name.

DropDatabaseAsync(string, CancellationToken)

Drops the database with the specified name.

GetDatabase(string, MongoDatabaseSettings)

Gets a database.

ListDatabaseNames(IClientSessionHandle, ListDatabaseNamesOptions, CancellationToken)

Returns the names of the databases on the server.

ListDatabaseNames(IClientSessionHandle, CancellationToken)

Returns the names of the databases on the server.

ListDatabaseNames(ListDatabaseNamesOptions, CancellationToken)

Returns the names of the databases on the server.

ListDatabaseNames(CancellationToken)

Returns the names of the databases on the server.

ListDatabaseNamesAsync(IClientSessionHandle, ListDatabaseNamesOptions, CancellationToken)

Returns the names of the databases on the server.

ListDatabaseNamesAsync(IClientSessionHandle, CancellationToken)

Returns the names of the databases on the server.

ListDatabaseNamesAsync(ListDatabaseNamesOptions, CancellationToken)

Returns the names of the databases on the server.

ListDatabaseNamesAsync(CancellationToken)

Returns the names of the databases on the server.

ListDatabases(IClientSessionHandle, ListDatabasesOptions, CancellationToken)

Lists the databases on the server.

ListDatabases(IClientSessionHandle, CancellationToken)

Lists the databases on the server.

ListDatabases(ListDatabasesOptions, CancellationToken)

Lists the databases on the server.

ListDatabases(CancellationToken)

Lists the databases on the server.

ListDatabasesAsync(IClientSessionHandle, ListDatabasesOptions, CancellationToken)

Lists the databases on the server.

ListDatabasesAsync(IClientSessionHandle, CancellationToken)

Lists the databases on the server.

ListDatabasesAsync(ListDatabasesOptions, CancellationToken)

Lists the databases on the server.

ListDatabasesAsync(CancellationToken)

Lists the databases on the server.

StartSession(ClientSessionOptions, CancellationToken)

Starts a client session.

StartSessionAsync(ClientSessionOptions, CancellationToken)

Starts a client session.

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

Watches changes on all collections in all databases.

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

Watches changes on all collections in all databases.

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

Watches changes on all collections in all databases.

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

Watches changes on all collections in all databases.

WithReadConcern(ReadConcern)

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

WithReadPreference(ReadPreference)

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

WithWriteConcern(WriteConcern)

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