mongo中常用的命令

命令使用mongo shell 执行

1.mongo中增加新字段

  mongo shell 进入后执行use table选中要添加字段的库

  db.getCollection('表名').update({}, {$set: {filed1:"",filed2:0}})

2.删除字段

db.getCollection('表名').update({},{$unset:{"字段名":""}},false,true)

  

猜你喜欢

转载自www.cnblogs.com/luqiang213917/p/11764330.html