我使用的数据库管理是mongobooster,添加的数据int类型自动变为了Double,而且修改valueType也不管用,只能自己执行mongo,update语句
db.表名.find({'字段名' : { $type : 1 }}).forEach(function(x) {
x.字段名 = NumberInt(1);
db.表名.save(x);
})
关于type的类型:(我从mongo官网摘下来的网址是:docs.mongodb.com/manual/refe…)
Type Number Alias Notes
Double 1 “double”
String 2 “string”
Object 3 “object”
Array 4 “array”
Binary data 5 “binData”
Undefined 6 “undefined” Deprecated.
ObjectId 7 “objectId”
Boolean 8 “bool”
Date 9 “date”
Null 10 “null”
Regular Expression 11 “regex”
DBPointer 12 “dbPointer” Deprecated.
JavaScript 13 “javascript”
Symbol 14 “symbol” Deprecated.
JavaScript (with scope) 15 “javascriptWithScope”
32-bit integer 16 “int”
Timestamp 17 “timestamp”
64-bit integer 18 “long”
Decimal128 19 “decimal” New in version 3.4.
Min key -1 “minKey”
Max key 127 “maxKey”