mongodump 會直接 dump 出 bson的 file
mongorestore 可以還原到 mongodb
mongodump -u user -p password --port port -h host -d dbname -c collection_name -o output_dir
- dump bson
mongodump -u user -p password --port port -h host -d dbname -c collection_name -o output_dir
ex
mongodump -u admin -p password --port 64631 -h 127.0.0.1 -d python -c post -o post
ex:
mongorestore -u admin -p password -h 127.0.0.1:40816 -d python -c post post2/python/post.bson
mongodump -u admin -p password --port 64631 -h 127.0.0.1 -d python -c post -o post
- restore from bson file
mongorestore -u user -p password -h host:port -d dbname -c collection_name bsonfile
mongorestore -u admin -p password -h 127.0.0.1:40816 -d python -c post post2/python/post.bson
沒有留言:
張貼留言