PHP Portal » PHP Handbuch » The MongoDB class

Werbung

The MongoDB class


Einführung

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

<?php
$m = new Mongo(); // connect
$db = $m->selectDB("example");
?>
Database names can use almost any character in the ASCII range. However, they cannot contain " ", "." or be the empty string.

A few unusual, but valid, database names: "null", "[x,y]", "3", "\"", "/".

Unlike collection names, database names may contain "$".

Klassenbeschreibung

MongoDB
MongoDB {
/* Constants */
const int MongoDB::PROFILING_OFF = 0 ;
const int MongoDB::PROFILING_SLOW = 1 ;
const int MongoDB::PROFILING_ON = 2 ;
/* Methods */
public array authenticate ( string $username , string $password )
public array command ( array $data )
__construct ( Mongo $conn , string $name )
public MongoCollection createCollection ( string $name [, bool $capped = FALSE [, int $size = 0 [, int $max = 0 ]]] )
public array createDBRef ( mixed $ns , mixed $a )
public array drop ( void )
public array dropCollection ( mixed $coll )
public array execute ( mixed $code [, array $args = array() ] )
public bool forceError ( void )
public MongoCollection __get ( string $name )
public array getDBRef ( array $ref )
public MongoGridFS getGridFS ([ string $arg1 = "fs" [, string $arg2 = NULL ]] )
public int getProfilingLevel ( void )
public array lastError ( void )
public array listCollections ( void )
public array prevError ( void )
public array repair ([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] )
public array resetError ( void )
public MongoCollection selectCollection ( string $name )
public int setProfilingLevel ( int $level )
public string __toString ( void )
}

Vordefinierte Konstanten

MongoDB Log Levels

MongoDB::PROFILING_OFF
0
Profiling is off.
MongoDB::PROFILING_SLOW
1
Profiling is on for slow operations (>100 ms).
MongoDB::PROFILING_ON
2
Profiling is on for all operations.

Inhaltsverzeichnis