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

getMore command does not set "nreturned" operation counter

    • Fully Compatible
    • ALL
    • QuInt D (12/14/15)

      The "nreturned" field is never displayed in the diagnostic log line generated by the getMore command. "nreturned" is properly shown for legacy OP_GET_MORE requests.

      Reproduce with the following script:

      > db.foo.drop()
      true
      > db.foo.insert([{},{},{},{},{}])
      BulkWriteResult({
      	"writeErrors" : [ ],
      	"writeConcernErrors" : [ ],
      	"nInserted" : 5,
      	"nUpserted" : 0,
      	"nMatched" : 0,
      	"nModified" : 0,
      	"nRemoved" : 0,
      	"upserted" : [ ]
      })
      > db.getMongo().forceReadMode('commands')
      > db.foo.find().batchSize(3).itcount()
      5
      > db.getMongo().forceReadMode('legacy')
      > db.foo.find().batchSize(3).itcount()
      5
      

      Output from the server when "commands" read mode is forced ("nreturned" not present for getMore):

      2015-12-02T17:48:07.148-0500 I COMMAND  [conn1] command test.foo command: find { find: "foo", filter: {}, batchSize: 3.0 } planSummary: COLLSCAN cursorid:30116070077 keysExamined:0 docsExamined:3 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:3 reslen:174 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms
      2015-12-02T17:48:07.149-0500 I COMMAND  [conn1] command test.foo command: getMore { getMore: 30116070077, collection: "foo", batchSize: 3.0 } ntoreturn:1 ntoskip:0 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 reslen:130 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms
      

      Output from the server when "legacy" read mode is forced ("nreturned" present for getMore):

      2015-12-02T17:48:13.083-0500 I QUERY    [conn1] query test.foo planSummary: COLLSCAN cursorid:33369655876 ntoreturn:3 ntoskip:0 keysExamined:0 docsExamined:3 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:3 reslen:86 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } 0ms
      2015-12-02T17:48:13.084-0500 I QUERY    [conn1] getmore test.foo cursorid:33369655876 ntoreturn:3 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:2 reslen:64 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } 0ms
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: