Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-14205

[SERVER] Bug in docs - _id queries on sharded collections are not actually covered

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: 4.0.0, 4.2.0, 4.4.0, 5.0.0, 6.0.0
    • Component/s: Server
    • Labels:
      None

      Our docs say:

      Starting in MongoDB 3.0, an index cannot cover a query on a sharded collection when run against a mongos if the index does not contain the shard key, with the following exception for the _id index: If a query on a sharded collection only specifies a condition on the _id field and returns only the _id field, the _id index can cover the query when run against a mongos even if the _id field is not the shard key.

      Either the docs are wrong, and queries on the _id index are not covered because they actually do fetch the full document through the IDHACK stage (rather than the normal FETCH stage) and do orphan filtering based on the shard key from the document.

      Or there is a server bug that queries on the _id index are covered, but orphan documents are not filtered out.

            Assignee:
            dave.cuthbert@mongodb.com Dave Cuthbert (Inactive)
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              1 year, 37 weeks, 4 days ago