The original data is:
{"u":1}
The type of 'u' is Int. After I run command in mongod console:
update({},{$set:{"u":0}})
find({})
data indeed become
{"u":0}
looks pretty ok. But when I use C++ driver to read them:
bson.getIntField("u")
Crash. The reason is type 'u' is Double! That means mongod's update command change u's type soundlessly.
Why? and how to prevent this?
P.S mongodb version is 2.6.6 linux