(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::getCollectionInfo
  • References/PHP/Function/Database/MongoDB driver/MongoDB

(PECL mongo >=1.6.0) Returns information about collections in this database

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

(PECL mongo >=0.9.5) Check if there was an error on the most recent db operation performed

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

(PECL mongo >=0.9.0) Fetches the document pointed to by a database reference

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

(PECL mongo >=0.9.0) Gets an array of MongoCollection objects for all collections in this database

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

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

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

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

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

(PECL mongo >=0.9.5) Creates a database error

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

(PECL mongo >=0.9.0) Drops a collection [deprecated]

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

(PECL mongo >=0.9.0) Fetches toolkit for dealing with files stored in this database

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

(PECL mongo >=0.9.2) Execute a database command

2025-01-10 15:47:30