number value if not warp NumberInt, it will change to double

li ning shared this problem 6 years ago
Not a Problem

whatever import a bson doc or just insert in window, every number type has been changed

Replies (2)

photo
1

The behavior is by design. In order to keep the behavior consistent with mongodb shell, MongoBooster will insert/update number as double type.


db.test.insert({a:1, b:1.0, c: 1.1, d: NumberInt("1.0"), e:Double("1.0")}) //or update
//before(<3.1.3): a: int32, b: int32, c:double, d: int32, e:double
//now (>=3.1.3): a: double, b: double, c:double, d: int32, e:double

photo
1

For some small tweak, I can warp NumberInt manually, but import bson, this bug will make import totally unusable. A bson doc may contain many int value, it is impossible to change them back by hand. Please fix this bug. All behavior should keep same as official mongodb. Thanks

photo
1

Which version are you using? And, Could you please give me a sampe BSON doc to recall the issue quickly?

photo
Leave a Comment
 
Attach a file