MongoDB数据库操作将int类型改为字符串类型
db.getCollection(‘test_point’).find({_id:{$exists:true}}).forEach(function(x){x.body.advertPosition=x.body.advertPosition+"";db.getCollection(‘test_point’).save(x);});这样就可以将document类型的body字段中的int类型的ad
·
db.getCollection(‘test_point’).find({_id:{$exists:true}}).forEach(function(x){
x.body.advertPosition=x.body.advertPosition+"";
db.getCollection(‘test_point’).save(x);
});
这样就可以将document类型的body字段中的int类型的advertPosition字段改为字符串类型
更多推荐
已为社区贡献4条内容
所有评论(0)