MongoDB.local SF, Jan 15: See the speaker lineup & ship your AI vision faster. Use WEB50 to save 50%
Find out more >
Docs Menu
Docs Home
/ /

MongoDB\Database Class

MongoDB\Database

Provides methods for common operations on a database, such as executing database commands and managing collections.

You can construct a database directly using the extension's MongoDB\Driver\Manager class or select a database from the library's MongoDB\Client class. A database may also be cloned from an existing MongoDB\Database object by using the withOptions() method.

MongoDB\Database supports the readConcern, readPreference, typeMap, and writeConcern options. If you omit an option, the database inherits the value from the Manager constructor argument or the Client object used to select the database.

Operations within the MongoDB\Database class inherit the Database's options.

Back

withCollection()

On this page