note 99103 added to mongo.updates
| From: | CharleDemers at osu1 dot php dot net | Date: | Tue, 27 Jul 2010 23:44:26 +0000 |
| Subject: | note 99103 added to mongo.updates | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171177@lists.php.net to get a copy of this message | ||
By default, the update method will only update one record (the first that matches the criteria), if
you want to update all matching records, you have to add the 'multiple' option, for
example, the equivalent of :
UPDATE bar SET enabled=false WHERE record_date='too_old';
Might be:
<?php
$collection = $mongo->selectDB("foo")->selectCollection("bar");
$cursor = $collection->update(
array('record_date'=>'too_old'),
array('enabled'=>false),
array('multiple'=true) );
?>
----
Server IP: 64.71.164.2
Probable Submitter: 69.70.118.26
----
Manual Page -- http://www.php.net/manual/en/mongo.updates.php
Edit -- https://master.php.net/note/edit/99103
Del: integrated -- https://master.php.net/note/delete/99103/integrated
Del: useless -- https://master.php.net/note/delete/99103/useless
Del: bad code -- https://master.php.net/note/delete/99103/bad+code
Del: spam -- https://master.php.net/note/delete/99103/spam
Del: non-english -- https://master.php.net/note/delete/99103/non-english
Del: in docs -- https://master.php.net/note/delete/99103/in+docs
Del: other reasons-- https://master.php.net/note/delete/99103
Reject -- https://master.php.net/note/reject/99103
Search -- https://master.php.net/manage/user-notes.php