[SERVER-36436] Deprecate the shell count() function Created: 03/Aug/18  Updated: 08/Jan/24  Resolved: 17/Mar/22

Status: Closed
Project: Core Server
Component/s: Querying, Shell
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Pavithra Vetriselvan Assignee: Backlog - Query Optimization
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Assigned Teams:
Query Optimization
Participants:

 Description   

The drivers have deprecated the count() function and added two new document count functions, countDocuments() and estimatedDocumentCount().

One option is to remove the count() function and then replace uses of count() with countDocuments(). I am not sure how we would communicate with users that we have deprecated this function, maybe through our regular documentation or printing a helpful error message?

Since we haven't really deleted code from the shell in such a way, we can also have count() call estimatedDocumentCount() and just update the behavior description.



 Comments   
Comment by Joe Kanaan [ 17/Mar/22 ]

mongo shell is no longer user facing given mongosh is available so no work will be done to keep it inline with the driver spec.

Comment by David Storch [ 28/Jun/21 ]

Moving this ticket back to the "Open" state. After further investigation and discussion, we are not yet planning to mark the shell's count() function as deprecated.

Comment by Asya Kamsky [ 06/Aug/18 ]

This should be resolved between the Query project to deprecate the count command and Platforms team which owns the shell.

Comment by Pavithra Vetriselvan [ 03/Aug/18 ]

behackett Definitely would not prefer that solution, I am just unsure of the current protocol for deprecating functions in the shell.

Comment by Bernie Hackett [ 03/Aug/18 ]

Since we haven't really deleted code from the shell in such a way, we can also have count() call countDocuments() and just update the behavior description.

Please don't do this. The drivers have all deprecated the helper. If the shell keeps it we'll be inconsistent. On top of that, having count() just call countDocuments() dramatically changes the performance, and in some cases behavior, of count(). https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#count-api-details

Generated at Thu Feb 08 04:43:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.