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
Post a Comment