From 48e1717a75a72c11438caeac29bb0fd0b0c02107 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Thu, 29 Nov 2012 00:51:28 +0000 Subject: [PATCH] Mention we populate the _id field with the pregenerated ID git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328551 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/mongocollection/save.xml | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/reference/mongo/mongocollection/save.xml b/reference/mongo/mongocollection/save.xml index 06a12ef273..010307dfac 100644 --- a/reference/mongo/mongocollection/save.xml +++ b/reference/mongo/mongocollection/save.xml @@ -124,6 +124,7 @@ $obj = array('x' => 1); // insert $obj into the db $collection->save($obj); +var_dump($obj); // add another field $obj['foo'] = 'bar'; @@ -137,9 +138,34 @@ $collection->save($obj); ?> ]]> + &example.outputs.similar; + + + int(1) + ["_id"]=> + object(MongoId)#4 (1) { + ["$id"]=> + string(24) "50b6afe544415ed606000000" + } +} +]]> + + + &reftitle.notes; + + + This method will create an _id field in the + a array with a pregenerated ID if the field didn't + exist already - unless the argument was a reference. + + + +