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

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

<?php

$m = new MongoClient(); // connect
$db = $m->selectDB("example");

?>

MongoDB::repair
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=0.9.0) Repairs and compacts this database

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

(PECL mongo >=0.9.5) Checks for the last error thrown during a database operation

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

(PECL mongo >=0.9.0) Creates a collection

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

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

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

(PECL mongo >=1.1.0) Change slaveOkay setting for this database

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

(PECL mongo >=0.9.0) The name of this database

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

(PECL mongo >=1.0.2) Gets a collection public

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

(PECL mongo >=0.9.0) Creates a new database

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

(PECL mongo >=0.9.3) Runs JavaScript code on the database server [deprecated]

2025-01-10 15:47:30