always insert int value
Solved
db.test.insert({number: 1}): insert `number` as int32, but it should be a double value
db.test.insert({number: 1}): insert `number` as int32, but it should be a double value
Yes, the mongo shell always treats a number as double. MongoDB Nodejs Driver will be smarter to select data types. if you insert '1', it will be an Int32, if you insert '1.1', it will be a double. Currently, NoSQLBooster uses MongoDB's NodeJS driver solution, so you'll see if you insert "1", you'll get an Int32 value "1", not a double value.
I think Nodejs driver's solution is better, MongoDB driver in other languages is similar to NodeJS. This does create inconsistencies with the implementation of mongo shell. I put this question on hold for the time being, and I want to hear more people's opinions.
If you want to insert a double value "1", please use the Double(1).
Yes, the mongo shell always treats a number as double. MongoDB Nodejs Driver will be smarter to select data types. if you insert '1', it will be an Int32, if you insert '1.1', it will be a double. Currently, NoSQLBooster uses MongoDB's NodeJS driver solution, so you'll see if you insert "1", you'll get an Int32 value "1", not a double value.
I think Nodejs driver's solution is better, MongoDB driver in other languages is similar to NodeJS. This does create inconsistencies with the implementation of mongo shell. I put this question on hold for the time being, and I want to hear more people's opinions.
If you want to insert a double value "1", please use the Double(1).
Resolved in 5.0.0, In the v5, always treats a number as double.
Resolved in 5.0.0, In the v5, always treats a number as double.
Replies have been locked on this page!