Sort (Ascending|Descending) on non-indexed field (works|asserts)

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 1.2.4, 1.3.4
    • Component/s: Querying
    • None
    • Environment:
      Ubuntu 9.10 x64
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If I run a sort query (with limit) on a collection in ascending order, everything operates properly:

      > db.signatures.find().sort(

      {numbb:1}

      ).limit(10)

      { "_id" : ObjectId("4b980bcb5506ca18cc00000d"), "numbb" : 2, "symbol" : "gen_raw_REG", "type" : "ssig", "signature" : BinData type: 2 len: 67 }

      .....

      But I actually want descending order:
      > db.signatures.find().sort(

      {numbb:-1}

      ).limit(10)
      error:

      { "$err" : "too much data for sort() with no index" }

      Curiously, a smaller limit works properly:
      > db.signatures.find().sort(

      {numbb:-1}

      ).limit(3)

      { "_id" : ObjectId("4b980ed75506ca18cc02d6fb"), "_types" : [ "Signature" ], "symbol" : "_ZN8LargeNet13doBuildInsideEv", "numbb" : 6323, "_cls" : "Signature", "signature" : BinData type: 2 len: 2364674, "type" : "ssig" }

      ....

      For reference, .limit(4) is apparently too large.

      If there's a good reason for this, so be it. I'm guessing, however, that this is due to the query optimizer doing quite different things depending on sort order.

            Assignee:
            Eliot Horowitz (Inactive)
            Reporter:
            John Demme
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: