0
点赞
收藏
分享

微信扫一扫

mongodb tips

幸福的无所谓 2022-01-26 阅读 47

导出数据

mongoexport卡住不能导出数据时,可以加上--forceTableScan选项来强制扫描表。

替换字段内容

db.bl.find({}).forEach( 
  function(item) {
    item.cate = String(item.cate).replace(',','>') ;
    item.cate_id = String(item.cate_id).replace(',','>') ;
    db.bl2.save(item);
  } 
 );

查找null类型

  • 字段存在且值为null:{ "field": { $type: 10 } }
  • 字段不存在:{ "field": { $exists: false } }
  • 同时查找以上两种类型:{ "field":null }
  • 同时过滤掉以上两种类型:{ "field":{ $ne : null } }
举报

相关推荐

代码tips

hadoop tips

VIM Tips

final Tips

Ubuntu Tips

0 条评论