Leveraging Group By/Distinct Query to use regular Index
When using Group By or Distinct queries on database, provide the ability to leverage existing index
i.e these queries today will miss using existing index
db.collection.distinct("field")
db.collection.aggregate([
{ $group: { _id: "$category", count: { $sum: 1 } } }
])
2
votes
