Skip to content

Improve count() and countDocuments() mapping documentation and/or method availability [DATAMONGO-2192] #3055

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

Closed
spring-projects-issues opened this issue Jan 28, 2019 · 0 comments
Assignees
Labels
type: documentation A documentation update type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Jeff opened DATAMONGO-2192 and commented

The mongodb documentation (not spring) outlines two different count calls - one is count() and the other is countDocuments()

After having a highly intermittent issue with an integration test receiving one less count than expected right after a write, I looked into potential problems with the count() query not being consistent, or fully accurate.

Here I discovered that count() can be inaccurate in certain situations, so in order to be 100% accurate, we'd have to do a countDocuments() call.

Issue is - the spring mongo data library only has a count() call. I cannot find any documentation about if the java .count() call maps to mongo's count() query or countDocuments() query.

 

Requests:

  • Add documentation for what spring mongo data's repository.count() maps to query-wise in mongo - count() or countDocuments()
  • if count() maps to count(), please add another method for repository.countDocuments()

 

Putting Label as "Spring" as I don't know if this is only a documentation issue or not, it could potentially result in added functionality


Affects: 2.1.4 (Lovelace SR4)

Issue Links:

  • DATAMONGO-2509 Polish documentation for 3.0 release

  • DATAMONGO-2059 Replace usage of deprecated collection.count() with collection.countDocuments()

@spring-projects-issues spring-projects-issues added type: documentation A documentation update type: enhancement A general enhancement labels Dec 30, 2020
@christophstrobl christophstrobl linked a pull request Jan 21, 2021 that will close this issue
@mp911de mp911de added this to the 3.1.4 (2020.0.4) milestone Feb 2, 2021
@mp911de mp911de closed this as completed in 076d334 Feb 2, 2021
mp911de pushed a commit that referenced this issue Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants