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

$in with sort doesnt use index

    XMLWordPrintable

    Details

      Description

      Query

      I have index on
      db.ogloszenia2.ensureIndex(

      {id:1, x:-1}

      );

      db.ogloszenia2.find({"id":397).limit(200).sort({"x":-1); //use index
      db.ogloszenia2.find({"id":422).limit(200).sort({"x":-1); //use index
      db.ogloszenia2.find({"id":{$in:[397,422]}).limit(200); //use index

      db.ogloszenia2.find({"id":{$in:[397,422]}).limit(200).sort({"x":-1); //does not use index

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                11 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: