Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-2192

Improve count() and countDocuments() mapping documentation and/or method availability

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.4 (Lovelace SR4)
    • Fix Version/s: None
    • Component/s: Documentation
    • Environment:
      Linux, mongodb 3.6

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cstrobl Christoph Strobl
              Reporter:
              jspringcoder Jeff
              Last updater:
              Christoph Strobl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: