Home > Article > System Tutorial > How to import, export, backup and restore mongodb
mongodump -h RuiyIp -d dataname -o /home/aa/dev/mongodb/data
mongodump mongo Export database command mongodump --help You can view all the help under this command
After the terminal scrolls through N lines, the database export is completed. You can go to the /home/aa/dev/mongodb/data directory to view the exported file, which is in bson format (I did not export it immediately after exporting. I saw the file, but it took a while for it to appear, for unknown reasons).
mongorestore -d cmsdev /home/xx/dev/mongodb/data/cmsdev
Add the directory you just exported directly after it, so that all tables can be restored directly. If -c is to restore one table
mongoimport -d my_mongodb -c user user.dat
Parameter Description:
You can see that the table structure will be created implicitly when importing data
mongoexport -d my_mongodb -c user -o user.dat
Parameter Description:
The above is the detailed content of How to import, export, backup and restore mongodb. For more information, please follow other related articles on the PHP Chinese website!