Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1695

libbson's bson-to-json does't allow for round tripping of Javascript type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 1.5.0
    • Fix Version/s: 1.5.0
    • Component/s: json
    • Labels:
      None

      Description

      libbson's bson-to-json converts the BSON Javascript type to just:

      { "foo" : "function foo(bar) { return bar; }" }
      

      (Document with single ```foo``` key).

      On the way from json-to-bson, there is no way to distinguish this from a (key => string) pair, and hence, libbson does not create a BSON Javascript type.

      I would suggest to use the "extended JSON"'s serialisation way:

          "CodeWithScope": {
              "$code": "function(){}",
              "$scope": {}
          },
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-c-driver Backlog - C Driver Team
              Reporter:
              derick Derick Rethans
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: