mongo笔记

# 登录mongo数据库
mongo
mongo -u 用户名 -p 密码 --authenticationDatabase 数据库名
# 数据库简单操作
show dbs
use 数据库名
show tables
db.数据库名.find()

db.createCollection("集合名")
db.集合名.drop()

# 导出导入操作
mongoexport -d 数据库名 -c 集合名 -o /db/SiteSettings.json --type json
mongoimport -d 数据库名 -c 集合名 --file /db/test.json --type json
# 带用户的
mongoexport -u 用户名 -p 密码 --authenticationDatabase 数据库名 -d 数据库名 -c 集合名 -o /db/test.json --type json
mongoimport -u 用户名 -p 密码 --authenticationDatabase 数据库名 -d 数据库名 -c 集合名 --file /db/test.json --type json

mongoexport -u 用户名-p 密码 --authenticationDatabase 数据库名 -d 数据库名 -c 集合名 -o /ApiDiscoveryUrls.csv --type csv --fields domainKey,method,uri

mongo导入导出

posted @ 2023-05-17 09:53  左岸丶  阅读(9)  评论(0编辑  收藏  举报