You want to know how many types of items you have in each category. Which query does this?

  •  db.product.group({_id: “$category”, count: {$sum:1}})
  •  db.product.aggregate($sum: {_id: “$category”, count: {$group:1}})
  •  db.product.aggregate($group: {_id: “$category”, count: {$sum:1}})
  •  db.product.aggregate($count: {_id: “$category”, count: {$group:1}})

Leave a Reply

Your email address will not be published. Required fields are marked *