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.
- 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.