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

Queries executed via MongoS will always project the sort key

    XMLWordPrintableJSON

Details

    Description

      This is a "gotcha" when using index filters and evaluating query performance.

      When you issue a query via a MongoS that includes both a Projection and a Sort field, the sort field will always be included within the projection set to the shards. This is needed for sorting on the result data from shards by desired field on the MongoS.

      This means when you are adding index filters using projections, you should always expect to add the sort field to the projection in sharded environments.

      Attachments

        Activity

          People

            andrew.aldridge@mongodb.com Andrew Aldridge
            david.hows David Hows
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 49 weeks, 2 days ago