Skip to content

Instantly share code, notes, and snippets.

@mattbates
Created April 15, 2014 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbates/10742961 to your computer and use it in GitHub Desktop.
Save mattbates/10742961 to your computer and use it in GitHub Desktop.
var c = db.coll.find();
while (c.hasNext() ) {
doc = c.next();
docs_array = db.test5.find({"fk" : doc.a}).toArray();
db.test.update({"_id" : doc._id}, {$set : { "test5" : docs_array } } );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment