[SERVER-17275] Remove "stats" field from distinct command response Created: 13/Feb/15  Updated: 19/Jul/17  Resolved: 15/Jul/16

Status: Closed
Project: Core Server
Component/s: Diagnostics, Querying
Affects Version/s: 3.0.0-rc8
Fix Version/s: 3.3.10

Type: Improvement Priority: Major - P3
Reporter: Jason R. Coombs Assignee: James Wahlin
Resolution: Done Votes: 1
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DRIVERS-314 Removal of 'stats' field from distinc... Closed
related to SERVER-17862 Unify stats reporting for log/profile... Closed
is related to DOCS-8357 3.4: Remove 'stats' field from distin... Closed
is related to SERVER-23325 Rename legacy metrics to match curren... Backlog
Backwards Compatibility: Fully Compatible
Sprint: Integration 17 (07/15/16)
Participants:

 Description   

When running a distinct query, the 'stats' still return using the keys from MongoDB 2.x:

> mongo
MongoDB shell version: 3.0.0-rc8
connecting to: test
> db.runCommand({distinct: 'items', key: 'name', query: {offered: false}})
{
        "values" : [ ],
        "stats" : {
                "n" : 0,
                "nscanned" : 0,
                "nscannedObjects" : 0
        },
        "ok" : 1
}

Since the explain output has renamed those stats keys' names, perhaps the distinct query should do the same for consistency. Specifically, those keys should be nReturned, totalKeysExamined, and totalDocsExamined. Best to do that before 3.0 goes gold, as it'll be more difficult and clumsy to perform later.



 Comments   
Comment by Githook User [ 15/Jul/16 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-17275 Remove 'stats' field from distinct command response
Branch: master
https://github.com/mongodb/mongo/commit/e5e2ecb49da979c5cc3534ae3cb76212a72e3986

Comment by Kyle Suarez [ 23/Mar/16 ]

Awesome, thanks! I'll fix the relevant DOCS links.

Comment by James Wahlin [ 23/Mar/16 ]

kyle.suarez - I spun off your request for field renames to SERVER-23325. This ticket will focus exclusively on retiring the distinct command "stats" field.

Comment by J Rassi [ 01/Mar/16 ]

I'm repurposing this ticket to remove the "stats" field entirely from the command response, as this information is now available from the explain command.

Comment by Kyle Suarez [ 09/Dec/15 ]

Documentation on DOCS-6768 will begin once this ticket has been resolved.

Comment by Kyle Suarez [ 09/Dec/15 ]

In addition, the following stats use legacy names and should be changed for consistency with both explain() and profiler output:

  • serverStatus.metrics.operation.scanAndOrder, which could be replaced by hasSortStage
  • geonear.stats.nscanned, which should be renamed with something like docsExamined
  • geonear.stats.objectsLoaded, which might make more sense as docsLoaded, though there is no exact equivalent in the profiler
Generated at Thu Feb 08 03:43:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.