Core Classes
PHP Manual

The Mongo class

Введение

A connection between PHP and MongoDB.

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

<?php

$m 
= new Mongo(); // connect
$db $m->foo// get the database named "foo"

?>

See Mongo::__construct() and the section on connecting for more information about creating connections.

Обзор классов

Mongo {
/* Константы */
const string Mongo::VERSION ;
const string Mongo::DEFAULT_HOST = "localhost" ;
const int Mongo::DEFAULT_PORT = 27017 ;
/* Fields */
public boolean $connected = FALSE ;
public string $status = NULL ;
protected string $server = NULL ;
protected boolean $persistent = NULL ;
/* Методы */
public bool close ( void )
public bool connect ( void )
protected bool connectUtil ( void )
__construct ([ string $server = "mongodb://localhost:27017" [, array $options = array("connect" => TRUE) [, bool $persist = false [, bool $garbage = false ]]]] )
public array dropDB ( mixed $db )
public MongoDB __get ( string $dbname )
public array getHosts ( void )
public string getSlave ( void )
public bool getSlaveOkay ( void )
public array listDBs ( void )
public MongoCollection selectCollection ( string $db , string $collection )
public MongoDB selectDB ( string $name )
public bool setSlaveOkay ([ bool $ok ] )
public string switchSlave ( void )
public string __toString ( void )
}

Предопределенные константы

Mongo Constants

Mongo::VERSION
PHP driver version. May be suffixed with "+" or "-" if it is in-between versions.
Mongo::DEFAULT_HOST
"localhost"
Host to connect to if no host is given.
Mongo::DEFAULT_PORT
27017
Port to connect to if no port is given.

Fields

status
If this is a persistent connection, if the connection was created for this object or is being reused. If this is not a persistent connection, this field should be NULL.

Смотрите также

MongoDB core docs on » connecting.

Содержание


Core Classes
PHP Manual