Error on non-object inputs when encoding BSON

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • bson-5.0.0
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • 3
    • Not Needed
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      DrPizza points out that we are presently unable to roundtrip single values through our javascript BSON library:

      • BSON.deserialize(BSON.serialize([])) yields "{}"
      • BSON.deserialize(BSON.serialize([1, 2, 3])) yields " {0: 1, 1: 2, 2: 3}

        "

      • BSON.deserialize(BSON.serialize(1)) yields "{}"
      • and so on..

      We should consider two approaches, and perhaps a marriage of the two:

      • Explicitly disallow non-object inputs
      • Provide a mechanism to roundtrip single values (perhaps wrapping the value in some reserved key like $$single$$, we do something similar in Swift)

              Assignee:
              Neal Beeken
              Reporter:
              Matt Broadstone
              Durran Jordan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: