Sorting on multiple keys when one is _id (when String) fails

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.3.3
    • Component/s: Querying
    • None
    • Environment:
      Mac OS
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Discovered to day that a sort on multiple fields fails when one is _id. In this case, I'm using a String as my _id, so it's relevant to sort on this field. Sorting just on _id or another fields works, but if I sort by another field and then _id, only _id sorting is performed. I compared with a multi-field sort not using _id (in this case "level" and "value_type") and this worked as expected: sorting occurred by level and then by value_type.

      Sorts only by _id:
      db.foo.find().sort(

      { some_key: 1, _id: 1}

      )

      Sorts properly by both keys:
      db.foo.find().sort(

      { some_key: 1, another_key: 1}

      )

            Assignee:
            Eliot Horowitz (Inactive)
            Reporter:
            Jamie Orchard-Hays
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: