- Reference >
- MongoDB\Database Class
MongoDB\Database Class
On this page
Definition
-
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 driver’s MongoDB\Driver\Manager class or select a database from the library’s
MongoDB\Clientclass. A database may also be cloned from an existingMongoDB\Databaseobject via thewithOptions()method.MongoDB\Databasesupports the readConcern, readPreference, typeMap, and writeConcern options. If you omit an option, the database inherits the value from the Manager constructor argument or theClientobject used to select the database.Operations within the
MongoDB\Databaseclass inherit the Database’s options.
Methods
- MongoDB\Database::__construct()
- MongoDB\Database::__get()
- MongoDB\Database::aggregate()
- MongoDB\Database::command()
- MongoDB\Database::createCollection()
- MongoDB\Database::drop()
- MongoDB\Database::dropCollection()
- MongoDB\Database::getDatabaseName()
- MongoDB\Database::getManager()
- MongoDB\Database::getReadConcern()
- MongoDB\Database::getReadPreference()
- MongoDB\Database::getTypeMap()
- MongoDB\Database::getWriteConcern()
- MongoDB\Database::listCollectionNames()
- MongoDB\Database::listCollections()
- MongoDB\Database::modifyCollection()
- MongoDB\Database::renameCollection()
- MongoDB\Database::selectCollection()
- MongoDB\Database::selectGridFSBucket()
- MongoDB\Database::watch()
- MongoDB\Database::withOptions()