028-86922220
建站资讯

网站建设资讯

为你提供网站建设行业资讯、网站优化知识、主机域名邮箱、网站开发常见问题等。

【mongo】mongo字段类型互转

mark一下
参考:
https://blog.csdn.net/laoyang360/article/details/72594344

1.str转long

  1. 当int很长时
  2. db.teststatement.find({"ctime":{$type: 2}}).forEach( function (x) {
  3.   x.ctime= NumberLong(x.ctime);
  4.   db.teststatement.save(x);
  5. })

2.int转str

  1. db.redefine_share_backwards.find( { 'share_uid' : { $gte : 0 } } ).forEach( function (x) { 
  2.  x.share_uid= ""+x.share_uid;
  3.  db.redefine_share_backwards.save(x);
  4. })



分享标题:【mongo】mongo字段类型互转
路径分享:http://whjierui.cn/article/iiogci.html

其他资讯