MongoDB 锟斤拷

(PECL mongo >=0.9.0)

锟斤拷锟�

锟斤拷锟斤拷锟绞碉拷锟斤拷锟斤拷诤锟斤拷锟斤拷菘锟斤拷锟叫斤拷锟斤拷锟斤拷要锟斤拷取一锟斤拷锟斤拷锟捷库:

Example #1 选锟斤拷一锟斤拷锟斤拷锟捷匡拷

<?php

$m 
= new MongoClient(); // 锟斤拷锟斤拷
$db $m->selectDB("example");

?>
锟斤拷锟捷匡拷锟斤拷锟斤拷锟斤拷锟斤拷 ASCII 锟斤拷围锟节的硷拷锟斤拷锟轿猴拷锟街凤拷锟斤拷 锟斤拷锟角o拷锟斤拷锟角诧拷锟杰帮拷锟斤拷 " "锟斤拷"."锟斤拷锟斤拷锟斤拷锟角匡拷锟街凤拷锟斤拷锟斤拷 锟斤拷锟斤拷 "system" 也锟角憋拷锟斤拷锟斤拷锟侥★拷

锟斤拷锟斤拷锟斤拷锟解但锟斤拷效锟斤拷锟斤拷锟捷匡拷锟斤拷锟斤拷"null"锟斤拷"[x,y]"锟斤拷"3"锟斤拷"\""锟斤拷 "/"锟斤拷

锟斤拷锟今集猴拷锟斤拷锟斤拷锟斤拷锟捷匡拷锟斤拷锟角匡拷锟皆帮拷锟斤拷 "$" 锟侥★拷

锟斤拷摘要

MongoDB {
/* 锟斤拷锟斤拷 */
const int PROFILING_OFF = 0 ;
const int PROFILING_SLOW = 1 ;
const int PROFILING_ON = 2 ;
/* Fields */
public integer $w = 1 ;
public integer $wtimeout = 10000 ;
/* 锟斤拷锟斤拷 */
public authenticate ( string $username , string $password ) : array
public command ( array $command [, array $options = array() ] ) : array
public __construct ( MongoClient $conn , string $name )
public createCollection ( string $name [, array $options ] ) : MongoCollection
public createDBRef ( string $collection , mixed $document_or_id ) : array
public drop ( void ) : array
public dropCollection ( mixed $coll ) : array
public execute ( mixed $code [, array $args = array() ] ) : array
public forceError ( void ) : bool
public __get ( string $name ) : MongoCollection
public getCollectionInfo ([ array $options = array() ] ) : array
public getCollectionNames ([ array $options = array() ] ) : array
public getDBRef ( array $ref ) : array
public getGridFS ([ string $prefix = "fs" ] ) : MongoGridFS
public getProfilingLevel ( void ) : int
public getReadPreference ( void ) : array
public getSlaveOkay ( void ) : bool
public getWriteConcern ( void ) : array
public lastError ( void ) : array
public listCollections ([ array $options = array() ] ) : array
public prevError ( void ) : array
public repair ([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] ) : array
public resetError ( void ) : array
public selectCollection ( string $name ) : MongoCollection
public setProfilingLevel ( int $level ) : int
public setReadPreference ( string $read_preference [, array $tags ] ) : bool
public setSlaveOkay ([ bool $ok = TRUE ] ) : bool
public setWriteConcern ( mixed $w [, int $wtimeout ] ) : bool
public __toString ( void ) : string
}

预锟斤拷锟藉常锟斤拷

MongoDB 锟斤拷志锟斤拷锟斤拷

MongoDB::PROFILING_OFF
0
锟截憋拷锟剿凤拷锟斤拷锟斤拷锟斤拷
MongoDB::PROFILING_SLOW
1
为锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟剿凤拷锟斤拷锟斤拷锟斤拷>100 ms锟斤拷锟斤拷
MongoDB::PROFILING_ON
2
为锟斤拷锟叫诧拷锟斤拷锟斤拷锟斤拷锟剿凤拷锟斤拷锟斤拷锟斤拷

锟街讹拷

w
1

锟节凤拷锟截成癸拷之前锟斤拷锟斤拷锟斤拷锟睫改碉拷锟斤拷锟斤拷锟斤拷锟侥凤拷锟斤拷锟斤拷锟斤拷 MongoCollection 实锟斤拷锟斤拷锟斤拷锟矫达拷锟斤拷锟斤拷坛小锟� w 锟斤拷锟斤拷锟斤拷 MongoDB 锟斤拷锟斤拷锟斤拷锟芥本 1.5.1+ 锟皆硷拷锟斤拷锟斤拷锟斤拷 1.0.8+ 锟斤拷效锟斤拷

w 锟斤拷锟斤拷锟斤拷锟斤拷要锟斤拷锟斤拷确锟较硷拷锟斤拷时 锟斤拷MongoCollection::insert()锟斤拷 MongoCollection::update()锟斤拷 MongoCollection::remove()锟斤拷 MongoCollection::save() 锟斤拷 MongoCollection::ensureIndex() 锟斤拷支锟斤拷锟斤拷锟窖★拷睿╋拷锟� 默锟斤拷值锟斤拷1锟斤拷锟斤拷锟斤拷拢锟街灰拷锟斤拷菘锟斤拷胁锟斤拷锟斤拷突锟饺凤拷稀锟� 锟斤拷锟斤拷诟锟斤拷频锟斤拷臃锟斤拷锟斤拷锟角帮拷锟斤拷锟斤拷锟藉椿锟斤拷耍锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷枚锟绞э拷锟斤拷尾锟斤拷锟斤拷锟� 锟斤拷锟皆o拷锟斤拷锟斤拷锟轿� w 指锟斤拷一锟斤拷锟斤拷一锟斤拷锟竭碉拷锟斤拷锟街o拷 锟节凤拷锟截成癸拷之前确锟斤拷锟斤拷锟斤拷一锟斤拷锟接凤拷锟斤拷锟斤拷锟斤拷锟斤拷瞬锟斤拷锟斤拷锟�

锟斤拷锟界,锟斤拷锟� w 锟斤拷 2锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟接凤拷锟斤拷锟斤拷锟斤拷录锟剿憋拷锟轿诧拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟阶筹拷 MongoCursorException锟斤拷 锟斤拷锟斤拷锟斤拷写锟斤拷锟杰硷拷 w 锟斤拷锟接凤拷锟斤拷锟斤拷 + 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟斤拷臃锟斤拷锟斤拷锟藉椿锟斤拷耍锟� 锟斤拷锟斤拷也锟斤拷失锟杰o拷锟斤拷锟斤拷锟阶筹拷锟届常锟斤拷锟斤拷锟斤拷通锟斤拷 w=2 锟斤拷锟筋安全锟侥o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟接凤拷锟斤拷锟斤拷锟斤拷锟斤拷

wtimeout
10000

锟饺达拷 MongoDB::$w 锟斤拷锟斤拷锟斤拷效锟侥猴拷锟斤拷锟斤拷锟斤拷 MongoCollection 实锟斤拷锟斤拷锟斤拷锟矫达拷锟斤拷锟斤拷坛小锟� w 锟斤拷锟斤拷锟斤拷 MongoDB 锟斤拷锟斤拷锟斤拷锟芥本 1.5.1+ 锟斤拷锟斤拷锟斤拷锟斤拷锟芥本 1.0.8+ 锟斤拷效锟斤拷

锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 wtimeout锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫等达拷锟斤拷锟狡碉拷 w 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟侥拷匣锟饺达拷 10 锟诫,锟斤拷锟斤拷锟斤拷薷锟斤拷锟斤拷值锟斤拷锟侥憋拷锟斤拷锟斤拷锟斤拷为锟斤拷

锟轿硷拷

MongoDB 锟斤拷锟斤拷 » databases 锟侥猴拷锟斤拷锟侥碉拷锟斤拷

Table of Contents