Uploaded image for project: 'Scala'
  1. Scala
  2. SCALA-309

Incorrect BSON to JSON parsing

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.0.0, 2.1.0
    • Fix Version/s: None
    • Component/s: bson, JSON
    • Environment:
      MacOS, Ubuntu and Alpine running in Kubernetes and on bare metal.

      Description

      Whenever I retrieve a Document from Mongo that contains a Long value, stored in the Bson format NumberLong, and try to parse it to Json using the Document.toJson method, it returns incorrectly formatted Json.

      Instead of receiving Json in the following form:

      { "expiryDate" : "1495821174705" }
      

      I receive Json in the following form:

      { "expiryDate" : { "$numberLong" : "1495821174705" } }
      

      None of the suggested fixes online work, I am not sure what the equivalent is for customizing the JsonWriterSettings as is suggested for the Java driver.

      If someone could tell me if this is a bug or a how to fix this I would appreciate it, currently we are manually fixing the error with Json4s which is not ideal.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: