> db.c.createIndex({a:1})
> db.c.insert({a:1})
WriteResult({ "nInserted" : 1 })
> db.c.aggregate({$group: {_id: "$a"}})
{ "_id" : 1 }
> db.c.explain().aggregate({$group: {_id: "$a"}})
// Distinct scan!
> db.c.explain().aggregate([{$group: {_id: "$a"}}], {hint: {$natural: 1}})
// Still distinct scan
This is probably because of the special codepath here which doesn't consider the hint.
- related to
-
SERVER-41458 $natural hint overrides index filters
-
- Closed
-
-
SERVER-14227 add index hint support for distinct command
-
- Closed
-