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

ID on exhausted cursor no longer 0

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.0.0
    • Component/s: None
    • Query Execution
    • ALL
    • Hide

      Using mongosh:

       

      // Insert fixtures
      for (i = 0; i < 16517; i++) {
        db.foo.insertOne({_id: i, record: `record${i}`})
      }
      
      // Test with 'find' command
      db.runCommand({
        'find': 'foo',
        'skip': 0,
        'tailable': false,
        'awaitData': false,
        'oplogReplay': false,
        'noCursorTimeout': false,
        'allowPartialResults': false,
        'singleBatch': false,
        'returnKey': false,
        'showRecordId': false,
        'filter': {
          'makeReq1': {
            '$exists': false
          }
        },
        'batchSize': 1,
        'limit': 1,
        'readConcern': {
          'level': 'local'
        },
        '$readPreference': {
          'mode': 'primary'
        }
      })
      

       

       

      With MongoDB 6.0.3; id: Long("0") as exhausted as limit already reached with the first.

       

      {
        cursor: {
          firstBatch: [ { _id: 0, record: 'record0' } ],
          id: Long("0"),
          ns: 'test.foo'
        },
        ok: 1
      }
      

       

       

      With MongoDB 7.0.0; id: Long("2959155384878848610")

       

      {
        cursor: {
          firstBatch: [ { _id: 0, record: 'record0' } ],
          id: Long("2959155384878848610"),
          ns: 'test.foo'
        },
        ok: 1
      }

       

      Show
      Using mongosh :   // Insert fixtures for (i = 0; i < 16517; i++) {   db.foo.insertOne({_id: i, record: `record${i}`}) } // Test with 'find' command db.runCommand({   'find' : 'foo' ,   'skip' : 0,   'tailable' : false ,   'awaitData' : false ,   'oplogReplay' : false ,   'noCursorTimeout' : false ,   'allowPartialResults' : false ,   'singleBatch' : false ,   'returnKey' : false ,   'showRecordId' : false ,   'filter' : {     'makeReq1' : {       '$exists' : false     }   },   'batchSize' : 1,   'limit' : 1,   'readConcern' : {     'level' : 'local'   },   '$readPreference' : {     'mode' : 'primary'   } })     With MongoDB 6 .0.3; id: Long(" 0 ") as exhausted as limit already reached with the first.   {   cursor: {     firstBatch: [ { _id: 0, record: 'record0' } ],     id: Long ( "0" ),     ns: 'test.foo'   },   ok: 1 }     With MongoDB 7.0.0; id: Long(" 2959155384878848610 ")   {   cursor: {     firstBatch: [ { _id: 0, record: 'record0' } ],   id: Long ( "2959155384878848610" ),     ns: 'test.foo'   },   ok: 1 }  
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi,

      First thanks for the great job with releasing MongoDB 7.

      Maintaining some tools around MongoDB, we can see that the ID of exhausted cursor is no longer indicated as 0.

      I cannot see any specific note about it in the changelog/driver compatibility documentation?

      Is it an intended behaviour (for now that raises as a bug for us) ?
      If yes how can we detected that such cursor is exhausted?

            Assignee:
            bernard.gorman@mongodb.com Bernard Gorman
            Reporter:
            chantepiecedric@gmail.com Cédric Chantepie
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None