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

Batch size + sort closes the cursor

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.0
    • Component/s: None
    • None
    • ALL

      Batch size becomes limit if sort is appended to it:

      > db.test.insert(

      {n: 1}

      )
      > db.test.insert(

      {n: 2}

      )
      > db.test.insert(

      {n: 3}

      )
      > db.test.insert(

      {n: 4}

      )
      > db.test.insert(

      {n: 5}

      )

      > db.test.find().batchSize(2).sort(

      {n: 1}

      )

      { "_id" : ObjectId("506e43b5681e3dfd1b92980b"), "n" : 1 } { "_id" : ObjectId("506e43b7681e3dfd1b92980c"), "n" : 2 }

      > db.test.find().batchSize(2)

      { "_id" : ObjectId("506e43b5681e3dfd1b92980b"), "n" : 1 } { "_id" : ObjectId("506e43b7681e3dfd1b92980c"), "n" : 2 } { "_id" : ObjectId("506e43b8681e3dfd1b92980d"), "n" : 3 } { "_id" : ObjectId("506e43b9681e3dfd1b92980e"), "n" : 4 } { "_id" : ObjectId("506e43ba681e3dfd1b92980f"), "n" : 5 }

      The problem seems to be in the server. I can reproduce the same issue with the Go driver.

            Assignee:
            Unassigned Unassigned
            Reporter:
            niemeyer Gustavo Niemeyer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: