Table of Contents

Method GetDatabase

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

GetDatabase(string)

Gets a MongoDatabase instance representing a database on this server.

public virtual MongoDatabase GetDatabase(string databaseName)

Parameters

databaseName string

The name of the database.

Returns

MongoDatabase

A new or existing instance of MongoDatabase.

GetDatabase(string, WriteConcern)

Gets a MongoDatabase instance representing a database on this server.

public virtual MongoDatabase GetDatabase(string databaseName, WriteConcern writeConcern)

Parameters

databaseName string

The name of the database.

writeConcern WriteConcern

The write concern to use with this database.

Returns

MongoDatabase

A new or existing instance of MongoDatabase.

GetDatabase(string, MongoDatabaseSettings)

Gets a MongoDatabase instance representing a database on this server.

public virtual MongoDatabase GetDatabase(string databaseName, MongoDatabaseSettings databaseSettings)

Parameters

databaseName string

The name of the database.

databaseSettings MongoDatabaseSettings

The settings to use with this database.

Returns

MongoDatabase

A new or existing instance of MongoDatabase.