I have a dataset of 3 million documents and I want to perform a
I find that if
$sort before I
$group my query only touches the indexes it goes pretty fast - but if my query looks at the contents of the documents it takes forever. Worse, if I attempt to
$match to reduce the query size it goes slower - even though my $match is on the same index as the $sort.
Are there some way to coax mongo into handling $group gueries better? For example can I hit to the
$group that the records are in-order so that it knows what once it finds a document that belongs to a different group that the previous group is complete?