Mongodb 常用操作命令
1:修改表列名 把companies表中identification列名修改为status
db.getCollection('companies').update({},{$rename:{'identification':'status'}},false,true)
db.getCollection('companies').update({},{$rename:{'short_name':'shortName'}},false,true)
db.getCollection('companies').update({},{$rename:{'company_intro_text':'companyIntroText'}},false,true)
db.getCollection('companies').update({},{$rename:{'href':'companyLink'}},false,true)
2:删除某一列 删除manager_list 一列
db.getCollection('companies').update({},{$unset:{'manager_list':''}},false, true)
db.getCollection('companies').update({},{$unset:{'lagou_url':''}},false, true)
db.getCollection('companies').update({},{$unset:{'history':''}},false, true)
db.getCollection('companies').update({},{$unset:{'company_img':''}},false, true)
导出一张表
mongoexport --host localhost --port 27017 --username quicktest --password quicktest --collection trans.sp --db quicktest --out trans.sp.json
导出一张表
mongoimport --host localhost --port 27019 --username quicktest --password quicktest --collection trans.sp --db quicktest --file /opt/kdf/trans.sp.json
文章来源: fizzz.blog.csdn.net,作者:拿我格子衫来,版权归原作者所有,如需转载,请联系作者。
原文链接:fizzz.blog.csdn.net/article/details/80320703
- 点赞
- 收藏
- 关注作者
评论(0)