note 99103 deleted from mongo.updates by danbrown
| From: | danbrown@php.net | Date: | Wed, 15 Sep 2010 21:33:54 +0000 |
| Subject: | note 99103 deleted from mongo.updates by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172616@lists.php.net to get a copy of this message | ||
Note Submitter: Charle Demers
----
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) );
?>