Skip to content

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

Closed
@spring-projects-issues

Description

@spring-projects-issues

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()

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions