Mongodb的几条命令

最近....

#设置用户名密码
db.createUser({user: 'root', pwd: '123456', roles: ['root']})

#开启认证
nohup mongod --auth -f /etc/mongod.conf&

#导出yapi
mongodump -h localhost -d yapi -o dump

#导入yapi
mongorestore -h xxxxxx -d yapi dump\yapi

#from mongod 4 --> mongod 3
/usr/local/mongo/bin/mongorestore -h 127.0.0.1 -d yapi dump/yapi --noIndexRestore

 https://docs.mongodb.com/manual/reference/program/mongorestore/#cmdoption--noIndexRestore

 

posted @ 2019-08-06 12:25  multitude  阅读(268)  评论(0)    收藏  举报