命令使用mongo shell 执行
1.mongo中增加新字段
mongo shell 进入后执行use table选中要添加字段的库
db.getCollection('表名').update({}, {$set: {filed1:"",filed2:0}})
2.删除字段
db.getCollection('表名').update({},{$unset:{"字段名":""}},false,true)
命令使用mongo shell 执行
1.mongo中增加新字段
mongo shell 进入后执行use table选中要添加字段的库
db.getCollection('表名').update({}, {$set: {filed1:"",filed2:0}})
2.删除字段
db.getCollection('表名').update({},{$unset:{"字段名":""}},false,true)