MongoDB3.4 mongodump and mongorestore back up and restore bson data, mongorestorebson

Source: Internet
Author: User
Tags mongodump mongorestore

MongoDB3.4 mongodump and mongorestore back up and restore bson data, mongorestorebson

Mongodump back up data to the bson File

If logon authorization is enabled for the database, you can back up the database as follows:

Mongodump-h database address (Port available, 27017 by default) -u user name-p password -- authenticationDatabase login authorization database-d name of the database to be exported-o export to the local path (such as c:/location)

If logon authorization is not enabled, remove the-u-p -- auth .. parameters. The-h parameter can be omitted for the local database and the default port number.

Mongorestore restores data to mongodb

If logon authorization is enabled for the database, it can be restored as follows

Mongorestore-h database address (Port available, 27017 by default) -u username-p password -- authenticationDatabase login authorization database-d name of the database to import data bson file in the local path (such as c:/location)

If logon authorization is not enabled, remove the-u-p -- auth .. parameters. The-h parameter can be omitted for the local database and the default port number.

Both methods are for the entire database. If you want to restore and back up only one collection and add the-c collection name

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.