find command implementation on mongos does not respect "singleBatch" option

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.1.9
    • Affects Version/s: None
    • Component/s: Querying, Sharding
    • None
    • Fully Compatible
    • ALL
    • Quint 9 09/18/15
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The implementation of the find command on mongos currently ignores the "singleBatch" option. Instead, the find command needs to delete the cursor associated with the user query if "singleBatch" is set.

      To reproduce:

      mongos> db.foo.insert({})
      WriteResult({ "nInserted" : 1 })
      mongos> db.foo.insert({})
      WriteResult({ "nInserted" : 1 })
      mongos> db.foo.insert({})
      WriteResult({ "nInserted" : 1 })
      mongos> db.foo.insert({})
      WriteResult({ "nInserted" : 1 })
      mongos> db.foo.runCommand({find:"foo", batchSize: 2, singleBatch: true})
      {
      	"cursor" : {
      		"id" : NumberLong("3770113749959775933"), // Unexpected: this value should be zero.
      		"ns" : "test.foo",
      		"firstBatch" : [
      			{
      				"_id" : ObjectId("55fb050f8be93f1540cba838")
      			},
      			{
      				"_id" : ObjectId("55fb050f8be93f1540cba839")
      			}
      		]
      	},
      	"ok" : 1
      }
      

            Assignee:
            J Rassi (Inactive)
            Reporter:
            J Rassi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: