(PECL mongo >=0.9.0)
Examples:
Selecting a database

Instances of this class are used to interact with a database. To get a database:

1
2
3
4
5
6
<?php
 
$m new MongoClient(); // connect
$db $m->selectDB("example");
 
?>
MongoDB::getCollectionNames
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=1.3.0) Gets an array of names for all collections in this database

2025-01-10 15:47:30
MongoDB::getWriteConcern
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=1.5.0) Get the write concern for this database

2025-01-10 15:47:30
MongoDB::createDBRef
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=0.9.0) Creates a database reference

2025-01-10 15:47:30
MongoDB::setProfilingLevel
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=0.9.0) Sets this database's profiling level

2025-01-10 15:47:30
MongoDB::getProfilingLevel
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=0.9.0) Gets this database's profiling level

2025-01-10 15:47:30
MongoDB::drop
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=0.9.0) Drops this database public

2025-01-10 15:47:30
MongoDB::authenticate
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=1.0.1) Log in to this database

2025-01-10 15:47:30
MongoDB::selectCollection
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=0.9.0) Gets a collection public

2025-01-10 15:47:30
MongoDB::setReadPreference
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=1.3.0) Set the read preference for this database

2025-01-10 15:47:30
MongoDB::resetError
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=0.9.5) Clears any flagged errors on the database

2025-01-10 15:47:30