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

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: 1.5.0
    • Component/s: json
    • None

      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": {}
          },
      

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

              Created:
              Updated:
              Resolved: