note 103798 deleted from mongocollection.update by danbrown
| From: | danbrown@php.net | Date: | Wed, 04 May 2011 15:03:18 +0000 |
| Subject: | note 103798 deleted from mongocollection.update by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179414@lists.php.net to get a copy of this message | ||
Note Submitter: eero at eero dot info
----
Quote from http://www.mongodb.org/display/DOCS/Updating
Checking the Outcome of an Update Request
As described above, a non-upsert update may or may not modify an existing object. An upsert will
either modify an existing object or insert a new object. The client may determine if its most recent
message on a connection updated an existing object by subsequently issuing a getlasterror command (
db.runCommand( "getlasterror" ) ). If the result of the getlasterror command contains an
updatedExisting field, the last message on the connection was an update request.
**If the updatedExisting field's value is true, that update request caused an existing object
to be updated; if updatedExisting is false, no existing object was updated.**
An "upserted" field will contain the new _id value if an insert is performed (new as of
1.5.4).
So, if you execute update(), and returned array's updateExisting key's value is false,
object was not updated.