MongoDB Import and Export

Source: Internet
Author: User
Tags mongodb download

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.