Created
July 18, 2012 13:23
-
-
Save sharpred/3136191 to your computer and use it in GitHub Desktop.
mongo update attachments metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mongoDB = new Mongo(); | |
$database = $mongoDB->selectDB("BVS"); | |
$collection = $database->createCollection('fs.files'); | |
$search = array("metadata.formdata.claimid" => "4"); | |
$replace = array('$set'=>array("metadata.formdata.mynewfield" => "wibble")); // note use of single quotes around $set. This is compulsory | |
$multiple = array("multiple" => true); // used to update all records that match default is false (update first record only) | |
$collection->update($search, $replace, $multiple); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment