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

.find().sort( { $natural: 1 } ) disables index use

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • v1.3.10
    • None
    • manual
    • None

    Description

      Regarding this page:
      http://docs.mongodb.org/manual/reference/method/cursor.sort/

      This contains a neat description of the use of .sort() specifically after a .find() and has a section at the bottom covering the special $natural operator.

      The page should make it clear that the use of $natural effectively disables the use of most indexes.

      There are some cases, particularly involving _id where $natural seems to work but these cases appear to be side-effects rather than intentional design choices.

      Attachments

        Activity

          People

            tim.slavin Tim Slavin
            andrew.ryder@mongodb.com Andrew Ryder (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9 years, 22 weeks, 5 days ago