[SERVER-54470] Add $collStats aggregate pipeline stage to API version 1 Created: 11/Feb/21  Updated: 29/Oct/23  Resolved: 17/Mar/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Bug Priority: Major - P3
Reporter: Benji Rewis (Inactive) Assignee: Charlie Swanson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-56780 [4.4] mongod collStats does not handl... Closed
is related to SERVER-53083 collStats results depend on topology ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Set API strict on a 4.9+ server.

Run an aggregate with the $collStats stage.

Sprint: Query Optimization 2021-03-08, Query Optimization 2021-03-22
Participants:
Linked BF Score: 157

 Description   

During the spec writing of DRIVERS-1437 in SPEC-1780, where we were changing estimatedDocumentCount to use $collStats instead of count, we expected that doing so would allow estimatedDocumentCount to be used with a strict API. However, we found that the $collStats stage is not a part of versioned API, as shown in this error "expected no error, but got (APIStrictError) stage $collStats is not allowed with 'apiStrict: true' in API Version 1".

If the $collStats stage in not included in API version 1, drivers will have to deprecate the estimatedDocumentCount function altogether, which is not ideal nor is it the apparent goal of the scope for removing count from API version 1.

It seems as though $collStats was initially intended to be part of API version 1 but was not added for some reason.



 Comments   
Comment by Githook User [ 17/Mar/21 ]

Author:

{'name': 'Charlie Swanson', 'email': 'charlie.swanson@mongodb.com', 'username': 'cswanson310'}

Message: SERVER-54470 Use IDL to parse $collStats
Branch: master
https://github.com/mongodb/mongo/commit/9d1a5300f40c6b8969ea5643c2b48361c2582b2e

Comment by Charlie Swanson [ 11/Feb/21 ]

As pointed out in this pull request, it would be good to include a test case which mirrors that in the drivers specification. This will give us an early warning if we break the drivers tests.

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