mark一下
参考:
https://blog.csdn.net/laoyang360/article/details/72594344
参考:
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);
- })
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29096438/viewspace-2155859/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29096438/viewspace-2155859/
本文介绍了如何在MongoDB中进行字符串到长整型(long)及整型(int)到字符串的转换操作,通过具体实例展示了使用NumberLong()函数将存储为字符串的长时间序列转换为long类型的方法,以及如何将整数类型的UID字段转换为字符串形式。
3万+

被折叠的 条评论
为什么被折叠?



