Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1877

Long value in cursor result isn't displayed properly in browser shell

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Browser Module
    • None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • 3
    • Developer Tools

      Description

      What is going wrong?

      The output of cursorId from the "$currentOp" aggregation stage differs between a Mongo Shell opened in Compass and a Mongo Shell opened from the command line.

      Steps to Reproduce

      Perform the steps below using the Mongo Shell built in Compass 1.44.4 and Mongo Shell 2.3.1

      1. Open a Mongo Shell using Compass 1.44.4 and a Mongo Shell from the command line to the same cluster.
      2. Open a change stream on test.collection to create an idle cursor
        use test
        db.collection.watch();
      3. Run $currentOp to list idle cursors
        db.getSiblingDB("admin").aggregate([
          { "$currentOp": { "idleCursors": true } },
          { "$match": { "type": "idleCursor", "ns": "test.collection" } }, 
          { "$project": { "cursor.cursorId": 1, "ns": 1 } }
        ]);
      4. In the Mongo Shell from Compass we see the following output:
        {
          ns: 'test.collection',
          cursor: {
            cursorId: 5467380098166794000
          }
        }
      5. In the Mongo Shell from the command line however:
        {
            ns: 'test.collection',
            cursor: { 
              cursorId: Long('5467380098166794545')
            }
        }

      Expected Results

      Output of cursorId should be of type Long in Mongo Shell from Compass

      Actual Results

      It appears that Mongo Shell in Compass is somehow converting the Long value and rounding down the value from Long('5467380098166794545') to 5467380098166794000

            Assignee:
            Unassigned Unassigned
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: