Created
April 11, 2012 21:40
-
-
Save ovaillancourt/2362888 to your computer and use it in GitHub Desktop.
Adding a field to all sub-documents of a certain collection.
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
//Mongodb shell script | |
db.MyCollection.update( | |
{'comments._id' : {$exists : true}}, | |
{$set : {'comments.$.author': PutYourValueHere}}, | |
false, | |
true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment