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

sorting doesn't work if sort field not included in projection

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.6.0
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • ALL

      load server with something like this:
      for (var i=0; i< 1000000;i++) {var r = Math.random(); db.foo.insert(

      {i:i, r:r, rr:r, s:s}

      )}
      db.foo.ensureIndex(

      {r:1}

      )

      test with this:
      r=-1
      db.foo.find({},

      {rr:1}

      ).sort(

      {r:1}

      ).forEach(function(z){ if (z.rr <= r)

      {printjson(z);print(r)}

      r= z.rr})

      you will see one printout each time mongos switches shards

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: