【mongo】mongo字段类型互转
mark一下
参考:
https://blog.csdn.net/laoyang360/article/details/72594344
新闻标题:【mongo】mongo字段类型互转
本文来源:http://cqwzjz.cn/article/iiogci.html
参考:
https://blog.csdn.net/laoyang360/article/details/72594344
1.str转long
- 当int很长时
-
db.teststatement.find({"ctime":{$type: 2}}).forEach( function (x) {
-
x.ctime= NumberLong(x.ctime);
-
db.teststatement.save(x);
- })
2.int转str
- db.redefine_share_backwards.find( { 'share_uid' : { $gte : 0 } } ).forEach( function (x) {
- x.share_uid= ""+x.share_uid;
- db.redefine_share_backwards.save(x);
- })
新闻标题:【mongo】mongo字段类型互转
本文来源:http://cqwzjz.cn/article/iiogci.html