-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 0.2.2
-
Component/s: Embedded Shell, Shell API
-
None
-
Iteration Lime
-
Needed
-
`NumberLong` is created incorrectly with unsafe integers (> Number.MAX_SAFE_INTEGER)
The same happens when retrieving a NumberLong which is an unsafe integer, even if was correctly inserted in the database.
The old shell correctly handles it:
New shell:
> db.coll3.insertOne({x: NumberLong("345678654321234561")})
{ acknowledged: 1, insertedId: ObjectId("5f564a3c4f53d376a739e656") }
> db.coll3.find()
[
{
_id: ObjectId("5f564a3c4f53d376a739e656"),
x: NumberLong(345678654321234560)
}
]
Old shell:
> db.coll5.insertOne({int64: NumberLong("345678654321234561")})
{
"acknowledged" : true,
"insertedId" : ObjectId("5f564a9284f79fe8de9e7e40")
}
> db.coll5.find()
{ "_id" : ObjectId("5f564a9284f79fe8de9e7e40"), "int64" : NumberLong("345678654321234561") }
NOTE: looks like is enough to use fromString (converting it before) instead of fromNumber here: https://github.com/mongodb-js/mongosh/blob/e4fb6ea6eae5f5d196038c68301af5bffea57070/packages/shell-api/src/shell-bson.ts#L122
- related to
-
COMPASS-4355 $match stage in Aggregation Pipeline builder does not find int64 fields
-
- Closed
-