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

Longs that fit into a JS Number is represented as a JS Number

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.15.0
    • Component/s: Shell API
    • Labels:
      None
    • Documentation Changes:
      Needed
    • Sprint:
      Iteration Düsseldorf

      Description

      Enterprise replset [direct: primary]> db.test.insertOne({ value: Long(10) })
      {
        acknowledged: true,
        insertedId: ObjectId("60b795a40a328707b213782a")
      }
      Enterprise replset [direct: primary]> db.test.find()
      [ { _id: ObjectId("60b795a40a328707b213782a"), value: 10 } ]
      

      The value is stored properly on the server, but because the driver defaults the promoteLongs option to true. The legacy shell returns NumberLong(10) instead.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: