-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
-
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)