(PECL mongo >=1.3.0)
Examples:
MongoClient basic usage

A connection manager for PHP and MongoDB.

This class is used to create and manage connections. A typical use is:

1
2
3
4
5
6
<?php
 
$m new MongoClient(); // connect
$db $m->foo; // get the database named "foo"
 
?>
MongoClient::getReadPreference
  • References/PHP/Function/Database/MongoDB driver/MongoClient

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

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

(PECL mongo >=1.3.0) Return info about all open connections

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

(PECL mongo >=1.3.0) String representation of this connection

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

(PECL mongo >=1.3.0) Gets a database collection

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

(PECL mongo >=1.3.0) Gets a database public

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

(PECL mongo >=1.3.0) Updates status for all associated hosts

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

(PECL mongo >=1.3.0) Lists all of the databases available.

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

(PECL mongo >=1.3.0) Connects to a database server

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

(PECL mongo >=1.3.0) Creates a new database connection object

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

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

2025-01-10 15:47:30