Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Enterprise Advanced
Created by Guest
Created on Apr 1, 2025

Prevent aggregation queries from appearing as poorly targeted queries

When looking at query targeting aggregate group queries can show up incorrectly as poorly targeted. For example if I select all documents with a given client id and group them by null and sum a field (eg revenue) then if there are 1,000,000 documents that get summed up to return 1 agregate document then it considers the query targeting to be 1,000,000 because it scanned 1,000,000 documents and returned one. This is highly misleading however since the query used an index to find the exact 1,000,000 documents needed and then used every single one of those documents to generate the output. What I would like to see would be something more like Scanned documents/Used Documents. Or possibly for aggregate queries that involve a group stage (and maybe other things) rather than look at the final output document count it could instead look at how many documents were passed into the group stage (ie that were actually used).