Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(NODE-4079): estimated document count uses count #3244

Merged
merged 9 commits into from May 18, 2022
Merged

Conversation

durran
Copy link
Member

@durran durran commented May 11, 2022

Description

Updates estimatedDocumentCount to use the count command.

What is changing?

Changes the operation to use a count command instead of an aggregate.

Is there new documentation needed for these changes?

None

What is the motivation for this change?

NODE-4079

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@durran
Copy link
Member Author

durran commented May 16, 2022

Note that this commit for DRIVERS-2228 (mongodb/specifications@021cbc8) did not include all the needed test changes to get the additional tests passing. Those were part of mongodb/specifications@c430376

@durran durran marked this pull request as ready for review May 16, 2022 15:08
@baileympearson baileympearson self-requested a review May 16, 2022 17:40
@baileympearson baileympearson added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label May 16, 2022
@baileympearson baileympearson self-assigned this May 16, 2022
Copy link
Contributor

@baileympearson baileympearson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec changes say we need to document the behavior (in addition to the release notes). Should we modify the comment on Collection.estimatedDocumentCount to include the relevant information?

see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#estimateddocumentcount

src/operations/estimated_document_count.ts Outdated Show resolved Hide resolved
@baileympearson
Copy link
Contributor

Can we also create a jira ticket and mark it for the next minor (4.7.0) with these changes, so we remember to include the relevant information in the release notes? See https://mongodb.slack.com/archives/GGWBN4ZNK/p1652725071464819

@durran
Copy link
Member Author

durran commented May 16, 2022

Can we also create a jira ticket and mark it for the next minor (4.7.0) with these changes, so we remember to include the relevant information in the release notes? See https://mongodb.slack.com/archives/GGWBN4ZNK/p1652725071464819

https://jira.mongodb.org/browse/NODE-4253

@durran
Copy link
Member Author

durran commented May 16, 2022

The spec changes say we need to document the behavior (in addition to the release notes). Should we modify the comment on Collection.estimatedDocumentCount to include the relevant information?

see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#estimateddocumentcount

I've updated the TSDoc to note this and link to the MongoDB docs.

@baileympearson
Copy link
Contributor

@durran

The spec changes say we need to document the behavior (in addition to the release notes). Should we modify the comment on Collection.estimatedDocumentCount to include the relevant information?
see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#estimateddocumentcount

I've updated the TSDoc to note this and link to the MongoDB docs.

There's also this blurb from the spec:

Drivers MUST document that, due to an oversight in versions 5.0.0-5.0.8 of MongoDB, the count command, which estimatedDocumentCount uses in its implementation, was not included in v1 of the Stable API, and so users of the Stable API with estimatedDocumentCount are recommended to upgrade their server version to 5.0.9+ or set apiStrict: false to avoid encountering errors.

Should we mention this in our comment as well?

@durran
Copy link
Member Author

durran commented May 17, 2022

@durran

The spec changes say we need to document the behavior (in addition to the release notes). Should we modify the comment on Collection.estimatedDocumentCount to include the relevant information?
see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#estimateddocumentcount

I've updated the TSDoc to note this and link to the MongoDB docs.

There's also this blurb from the spec:

Drivers MUST document that, due to an oversight in versions 5.0.0-5.0.8 of MongoDB, the count command, which estimatedDocumentCount uses in its implementation, was not included in v1 of the Stable API, and so users of the Stable API with estimatedDocumentCount are recommended to upgrade their server version to 5.0.9+ or set apiStrict: false to avoid encountering errors.

Should we mention this in our comment as well?

Put in TSDoc as well now.

baileympearson
baileympearson previously approved these changes May 17, 2022
@baileympearson baileympearson added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels May 17, 2022
@@ -535,81 +535,81 @@ describe('Collection', function () {
});
});

describe('(countDocuments)', function () {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests pass locally but fail on CI so I just rewrote them. They also weren't testing anything in some cases since any type of count would return 0 if no documents were inserted.

@baileympearson baileympearson merged commit a752e75 into main May 18, 2022
@baileympearson baileympearson deleted the NODE-4079 branch May 18, 2022 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
2 participants