diff --git a/reference/mongo/book.xml b/reference/mongo/book.xml index f45d785e9d..50555ccee7 100644 --- a/reference/mongo/book.xml +++ b/reference/mongo/book.xml @@ -36,7 +36,6 @@ &reference.mongo.mongodb; &reference.mongo.mongocollection; &reference.mongo.mongocursor; - &reference.mongo.mongoemptyobj; &reference.mongo.mongogridfs; &reference.mongo.mongogridfsfile; &reference.mongo.mongogridfscursor; diff --git a/reference/mongo/ini.xml b/reference/mongo/ini.xml index c7974a3d2b..5815bff1cd 100644 --- a/reference/mongo/ini.xml +++ b/reference/mongo/ini.xml @@ -51,6 +51,11 @@ 262144 PHP_INI_SYSTEM + + mongo.cmd + $ + PHP_INI_ALL + @@ -152,6 +157,18 @@ + + + mongo.cmd + string + + + + A character to be used in place of $. + + + + diff --git a/reference/mongo/mongocollection/update.xml b/reference/mongo/mongocollection/update.xml index c7d18dc5f8..451df90d87 100644 --- a/reference/mongo/mongocollection/update.xml +++ b/reference/mongo/mongocollection/update.xml @@ -60,6 +60,44 @@ Returns if the update was successfully sent to the database. + + &reftitle.examples; + + <function>MongoCollection::update</function> + + Adding an address field to a document. + + +insert(array("firstname" => "Bob", "lastname" => "Jones" )); +$newdata = array('$set' => array("address" => "1 Smith Lane")); +$c->update(array("firstname" => "Bob"), $newdata); + +var_dump($c->findOne(array("firstname" => "Bob"))); + +?> +]]> + + &example.outputs.similar; + + + object(MongoId)#6 (0) { + } + ["firstname"]=> + string(3) "Bob" + ["lastname"]=> + string(5) "Jones" + ["address"]=> + string(12) "1 Smith Lane" +} +]]> + + + - - - - The MongoEmptyObj class - MongoEmptyObj - - - - -
- &reftitle.intro; - - This class is used to insert an empty object into the database. - - - Inserting an empty array will create an array-type document, which can - be used for (among other things) $push updates: - - -insert(array('x' => array())); -?> -]]> - - The shell shows that an empty array is saved as an array: - - db.collection.findOne() -{ 'x' : [] } -]]> - - - Inserting a MongoEmptyObj will create an object-type document: - - -insert(array('x' => new MongoEmptyObj())); -?> -]]> - - The shell shows that a MongoEmptyObj is saved as an object: - - db.collection.findOne() -{ 'x' : {} } -]]> - -
- - -
- &reftitle.classsynopsis; - - - - MongoEmptyObj - - - - - MongoEmptyObj - - - - - - - -
- -
- -
- -