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

Batch size + sort closes the cursor

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.2.0
    • None
    • None
    • None
    • ALL

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: