-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: bson-4.6.5
-
Component/s: EJSON
What problem are you facing?
Spec tests say -0 should be serialized to EJSON differently from +0:
This isn’t something that’s easily fixable for the relaxed EJSON, since JSON.stringify(-0) === '0', but should be fixable for canonical EJSON.
(This only occurs with -0 JS numbers, not Double(-0) bson objects.)
What driver and relevant dependency versions are you using?
Latest js-bson (4.6.5).
Steps to reproduce?
> EJSON.stringify({ neg: -0, pos: 0 }, { relaxed: false }) '{"neg":{"$numberInt":"0"},"pos":{"$numberInt":"0"}}'
- related to
-
NODE-4335 negative 0 should serialize to Double
- Closed