You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/upgrade-to-v5.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,3 +100,21 @@ The following deprecated methods have been removed:
100
100
-`ObjectId.prototype.get_inc`
101
101
-`ObjectId.get_inc`
102
102
- The `static getInc()` is private since invoking it increments the next `ObjectId` index, so invoking would impact the creation of subsequent ObjectIds.
103
+
104
+
### Negative Zero is now serialized to Double
105
+
106
+
BSON serialize will now preserve negative zero values as a floating point number.
107
+
108
+
Previously it was required to use the `Double` type class to preserve `-0`:
Copy file name to clipboardExpand all lines: test/node/double.test.ts
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
1
import*asBSONfrom'../register-bson';
2
2
constDouble=BSON.Double;
3
3
4
+
constBSON_DOUBLE_TYPE_INDICATOR=0x01;
5
+
constBSON_INT_TYPE_INDICATOR=0x10;
6
+
4
7
describe('BSON Double Precision',function(){
5
8
context('class Double',function(){
6
9
describe('constructor()',function(){
@@ -78,14 +81,15 @@ describe('BSON Double Precision', function () {
78
81
});
79
82
});
80
83
81
-
it('NODE-4335: does not preserve -0 in serialize-deserialize roundtrip if JS number is used',function(){
82
-
// TODO (NODE-4335): -0 should be serialized as double
83
-
// This test is demonstrating the behavior of -0 being serialized as an int32 something we do NOT want to unintentionally change, but may want to change in the future, which the above ticket serves to track.
84
+
it('does preserve -0 in serialize as a double',function(){
0 commit comments