Java from entry to entry-database Mongo DB Export, Import, backup, from entry to entry-level mongo
I. Overview
This blog tells you how Mongo DB imports and exports data and backs up data.
In the following operations, you must open the Mongo DB server to perform the operation.
Ii. Export.
MongoDB export is very simple. Open cmd and enter the following command.
Export export-d foobar-c persons-o D:/persons. json
If you want to import the database documents of other hosts, write
Mongoexport -- host 192.168.0.16 -- port 37017
Iii. Import
It's also easy to open cmd and enter the following command
Export Import -- db foobar -- collection persons -- file d:/persons. json
Iv. Backup
MongoDB backup is simple. Open cmd and enter the following command.
Mongodump -- host 127.0.0.1: 27017-d foobar-o d:/foobar
It's easy to recover data. Open cmd and enter the following command.
Mongorestore -- host 127.0.0.1: 27017-d foobar-directoryperdb d:/foobar
V. Summary
Import, export, and backup operations are common operations. This blog introduces these operations.