mongodb添加文件和導出文件

mongoexport -d test -u admin -p admin -c collection --out test.json --jsonArray
// 導出
mongoimport -d test -u admin -p admin -c collection --file test.json --jsonArray
// 導入

切記需要在mongodb目錄下面的bin目錄下執行,必須要退出mongo命令

 

當自己設置的賬號或密碼一直提示錯誤的時候  驗證不成功 需要加上這句話

這個問題困擾我許久 , 記錄下來

添加--authenticationDatabase=admin ,導出成功

mongoimport -d xdd2123 -u admin -p pwd -c oderss --authenticationDatabase=admin  --file /www/server/data/orders.json

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章