One: The export function of MongoDB
MongoDB provides the ability to import and export, respectively, the Mongoexport.exe and Mongoimport.exe files in the MongoDB download directory, the specific Export command format is as follows:
Mongoexport-h dbhost-d dbname-c collectionname-o output
Parameter description:
-H Database Address
-d indicates which library to use
-C indicates the collection to be exported
-O indicates the file name to export (file supports multiple formats, such as Txt,wps,xls, etc.)
Specific examples:
Mongoexport-h localhost:27017-d kaiye-c C2-o c://mongoexport/test.txt
Mongoexport-h localhost:27017-d kaiye-c C2-o c://mongoexport/test.wps
Mongoexport-h localhost:27017-d kaiye-c C2-o C://mongoexport/test.xls
II: MongoDB's Import function
You can use commands to import data:
Mongoimport-h dbhost-d dbname-c CollectionName input
Parameter description:
-H Database Address
-d indicates which library to use
-C indicates the collection to be imported (MongoDB itself supports implicit creation, so there is no need to create a collection beforehand)
The address of the input file
Specific examples:
Mongoimport-h localhost:27017-d kaiye-c Fuck c://mongoexport/test.txt
Mongoimport-h localhost:27017-d kaiye-c fuck1 c://mongoexport/test.wps
Mongoimport-h localhost:27017-d kaiye-c Fuck2 C://mongoexport/test.xls
MongoDB Import and Export