I have a question about mongodb and node.js. I have this collection named PIZZA
{ title: "bacon" }
{ title: "pepperoni" }
and another collection named ORDERS
{ orderid: 1, pizza: "bacon" }
{ orderid: 2, pizza: "pepperoni" }
{ orderid: 3, pizza: "bacon" }
{ orderid: 4, pizza: "bacon" }
I need to have a result like this
{ title: "bacon", orders: 3 }
{ title: "pepperoni", orders: 1 }
Can I have this with one query?
I need to know how many items there are in collection ORDERS and merge results with collection PIZZA, I'm using MongoClient