note 95418 added to mongocollection.remove
| From: | DavidWinter at osu1 dot php dot net | Date: | Sat, 02 Jan 2010 13:55:09 +0000 |
| Subject: | note 95418 added to mongocollection.remove | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164535@lists.php.net to get a copy of this message | ||
To remove a document based on its ID, you need to ensure that you pass the ID as a MongoID object
rather than just a string:
<?php
$id = '4b3f272c8ead0eb19d000000';
// will not work:
$collection->remove(array('_id' => $id), true);
// will work:
$collection->remove(array('_id' => new MongoId($id)), true);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 78.149.181.66
----
Manual Page -- http://www.php.net/manual/en/mongocollection.remove.php
Edit -- https://master.php.net/note/edit/95418
Del: integrated -- https://master.php.net/note/delete/95418/integrated
Del: useless -- https://master.php.net/note/delete/95418/useless
Del: bad code -- https://master.php.net/note/delete/95418/bad+code
Del: spam -- https://master.php.net/note/delete/95418/spam
Del: non-english -- https://master.php.net/note/delete/95418/non-english
Del: in docs -- https://master.php.net/note/delete/95418/in+docs
Del: other reasons-- https://master.php.net/note/delete/95418
Reject -- https://master.php.net/note/reject/95418
Search -- https://master.php.net/manage/user-notes.php