note 92207 deleted from mongocollection.insert by derick

From: Date: Thu, 29 Nov 2012 13:03:50 +0000
Subject: note 92207 deleted from mongocollection.insert by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192196@lists.php.net to get a copy of this message
Note Submitter: quintonparker at gmail dot com ---- Worth noting that insert() accepts the array by reference On successful insert the array is returned with the _id assigned by Mongo <?php $doc = array( 'key1' => 'yay', 'key2' => 'yipee', ); ?> therefore becomes: <?php $doc = array( 'key1' => 'yay', 'key2' => 'yipee', '_id' => '4a5c9100fbecbc00503debc8' ); ?> Handy. Akin to mysql's SELECT LAST_INSERT_ID() without the hassle of having to send another query :-)

« previous php.notes (#192196) next »