[COMPASS-7431] Importing $numberDouble json with a number that's an integer makes it int32 Created: 08/Nov/23  Updated: 18/Dec/23  Resolved: 18/Dec/23

Status: Closed
Project: Compass
Component/s: Import/Export
Affects Version/s: 1.40.4
Fix Version/s: 1.41.0

Type: Bug Priority: Major - P3
Reporter: Rhys Howell Assignee: Le Roux Bodenstein
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS:
node.js / npm versions:
Additional info:


Attachments: PNG File Screenshot 2023-11-08 at 3.00.56 PM.png     File doubleNum.json    
Story Points: 2
Documentation Changes: Not Needed

 Description   

Example doc to import (json file with this attached):
```
[{
  "doubleNum":

{     "$numberDouble": "-45"   }

}]
```

Results in Int32 type:

Probably needs a `promoteValues: false` in the ejson deserialize: https://github.com/mongodb-js/compass/blob/50b2b2966e1eae0c92a60877f40a5e94624cec14/packages/compass-import-export/src/import/import-json.ts#L81 
Let's also add a regression test.



 Comments   
Comment by Githook User [ 13/Nov/23 ]

Author:

{'name': 'Le Roux Bodenstein', 'email': 'lerouxb@gmail.com', 'username': 'lerouxb'}

Message: fix: pass relaxed: false to EJSON.deserialize() so values won't be promoted COMPASS-7431 (#5090)

pass relaxed: false to EJSON.deserialize
Branch: feature/COMPASS-7331
https://github.com/mongodb-js/compass/commit/60997d1779193debb0ffac4c4e423d1747783697

Comment by Githook User [ 10/Nov/23 ]

Author:

{'name': 'Le Roux Bodenstein', 'email': 'lerouxb@gmail.com', 'username': 'lerouxb'}

Message: fix: pass relaxed: false to EJSON.deserialize() so values won't be promoted COMPASS-7431 (#5090)

pass relaxed: false to EJSON.deserialize
Branch: beta-releases
https://github.com/mongodb-js/compass/commit/60997d1779193debb0ffac4c4e423d1747783697

Comment by Githook User [ 10/Nov/23 ]

Author:

{'name': 'Le Roux Bodenstein', 'email': 'lerouxb@gmail.com', 'username': 'lerouxb'}

Message: fix: pass relaxed: false to EJSON.deserialize() so values won't be promoted COMPASS-7431 (#5090)

pass relaxed: false to EJSON.deserialize
Branch: 7432-dev
https://github.com/mongodb-js/compass/commit/60997d1779193debb0ffac4c4e423d1747783697

Comment by Githook User [ 10/Nov/23 ]

Author:

{'name': 'Le Roux Bodenstein', 'email': 'lerouxb@gmail.com', 'username': 'lerouxb'}

Message: fix: pass relaxed: false to EJSON.deserialize() so values won't be promoted COMPASS-7431 (#5090)

pass relaxed: false to EJSON.deserialize
Branch: fix-fonts
https://github.com/mongodb-js/compass/commit/60997d1779193debb0ffac4c4e423d1747783697

Comment by Githook User [ 10/Nov/23 ]

Author:

{'name': 'Le Roux Bodenstein', 'email': 'lerouxb@gmail.com', 'username': 'lerouxb'}

Message: fix: pass relaxed: false to EJSON.deserialize() so values won't be promoted COMPASS-7431 (#5090)

pass relaxed: false to EJSON.deserialize
Branch: main
https://github.com/mongodb-js/compass/commit/60997d1779193debb0ffac4c4e423d1747783697

Comment by Le Roux Bodenstein [ 09/Nov/23 ]

Extended JSON parsing does not support promoteValues: false. It is always the equivalent of promoteValues: true

See https://github.com/mongodb/js-bson/blob/77fac2a369c9009e88604a9dce0c688778826973/src/extended_json.ts#L87-L113

Generated at Wed Feb 07 22:46:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.