MongoDB Data Import and export

Source: Internet
Author: User

MongoDB Data Import and export

The Mongoexport in MongoDB is responsible for data export

The Mongoimport in MongoDB is responsible for data import

The Mongoexport tool allows you to export data tables in MongoDB to a file in JSON or CSV format

Export CSV Format example:

Export user,createtime,gold,level,region,vip_level item data from data table user in data gamedb to file/home/data/user.csv

-D: Indicates which library to use, in this case gamedb

-C: Indicates the collection to be exported, in this case the user

-O: Indicates the name of the file to be exported, in this case user.csv

-csv: Indicates that you want to export to CSV format

-F: Indicates that you need to export data for user, createtime, gold, level, region, vip_level columns

mongoexport-d gamedb-c user--csv-f User,createtime,gold,level,region,vip_level-o/home/data/user.csv

Export JSON format example:

Export data from data table user in data gamedb to file/home/data/user.json, export JSON format without specifically pointing out data items in the packet

mongoexport-d gamedb-c User-o/home/data/user.json

MongoDB Data 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.