【mongo】mongo字段类型互转
mark一下
参考:
https://blog.csdn.net/laoyang360/article/details/72594344
分享题目:【mongo】mongo字段类型互转
本文链接:http://ybzwz.com/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://ybzwz.com/article/iiogci.html