Last active
June 19, 2016 15:19
-
-
Save notgiorgi/3b5935250559428f67ac206dacd57a57 to your computer and use it in GitHub Desktop.
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
// Get all products of category with _id:0 and it's child categories | |
// category : { | |
// _id : Number, | |
// name : String, | |
// ancestors : Array<_id> | |
// } | |
var cursor = db.collection('categories').find({ ancestors : 0 }); | |
cursor.forEach((doc) => { | |
db.collection('products').find({ category : doc._id }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment