How to compare array with find() in mongoDB meteor App -


for array templates, want compare elements mongodb entries.

templates=[a,b,c]

for(templates) {             template.displayproduct.pendingproducts = products.find({"template_name": <compare here, doubt>}, {                 "price": 1,                 "brand": 1,                 "productid": 1,                 _id: 0             });     } 

assuming there name field on templates, can use foreach , put in template's name directly

templates.foreach(function (temp) {             template.displayproduct.pendingproducts = products.find({"template_name": temp.name}, {                 "price": 1,                 "brand": 1,                 "productid": 1,                 _id: 0             });     }); 

but code, end results latest loop cycle in template.displayproduct.pendingproducts.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -