mongo数据的导出

导出csv文件
mongoexport --host 192.168.0.1 --db test_db --collection test_table --csv --fieldFile fields.txt --out mongo_output.csv -q '{$query: {_id: {$gt: 12345}}}'


使用mongodump & mongorestore
引用
mongodump --host mongodb1.example.net --db db --collection collectionname --port 37017 --username user --password pass --out /opt/backup/mongodump-2011-10-24

mongorestore --host mongodb1.example.net --db db --collection collectionname --port 37017 --username user --password pass --out /opt/backup/mongodump-2011-10-24


猜你喜欢

转载自luozhaoyu.iteye.com/blog/1859438
今日推荐