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
This commit is contained in:
Hannes Magnusson 2012-11-29 00:51:28 +00:00
parent 8bbdbb8d6b
commit 48e1717a75

View file

@ -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);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(2) {
["x"]=>
int(1)
["_id"]=>
object(MongoId)#4 (1) {
["$id"]=>
string(24) "50b6afe544415ed606000000"
}
}
]]>
</screen>
</example>
</refsect1>
<refsect1 role="notes"><!-- {{{ -->
&reftitle.notes;
<note>
<para>
This method will create an <literal>_id</literal> field in the
<parameter>a</parameter> array with a pregenerated ID if the field didn't
exist already - unless the argument was a reference.
</para>
</note>
</refsect1><!-- }}} -->
</refentry>
<!-- Keep this comment at the end of the file
Local variables: