Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-3645

Sharded collection counts (on primary) can report too many results

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Querying
    • Labels:
      None

      Description

      Summary

      Count does not filter out unowned (orphaned) documents and can therefore report larger values than one will find via a normal query, or using itcount() in the shell.

      Causes

      The following conditions can lead to counts being off:

      • Active migrations
      • Orphaned documents (left from failed migrations)
      • Non-Primary read preferences (see SERVER-5931)

      Workaround

      A workaround to get accurate counts is to ensure all migrations have been cleaned up and no migrations are active. To query non-primaries you must also ensure that there is no replication lag including any migration data, in addition to the above requirements.

      Non-Primary Reads

      For issues with counts/reads from non-primaries please see SERVER-5931

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                49 Vote for this issue
                Watchers:
                83 Start watching this issue

                Dates

                • Created:
                  Updated: