Skip to content

Instantly share code, notes, and snippets.

@bgvo
Created December 2, 2014 18:06
Show Gist options
  • Save bgvo/fdb9b6d521aea9148ddf to your computer and use it in GitHub Desktop.
Save bgvo/fdb9b6d521aea9148ddf to your computer and use it in GitHub Desktop.
querying inside foreach
db.ratings.find().forEach(function(doc){
var item = db.items.find({_id: doc.item_id})
var ry = item.detail.ry
})
ITEM
{
"_id" : ObjectId("5461c8f0426f727f16000000"),
"n" : "The Shawshank Redemption",
"detail" : {
"ry": 1992
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment