edit-icon download-icon

Import data through built-in utilities

Last Updated: Nov 13, 2017

MongoDB has built-in mongodump and mongorestore utilities that can import and export data.

Note: Use the mongodump and mongorestore utilities of MongoDB 3.0 or later versions.

Procedure

  1. Back up user-created database data.

    Connect to the user-created database and select an account with the relevant permissions. Then, run mongodump to export the content of the user-created database. For example, run the following statement to export all databases and create a backup file named dump:

    1. mongodump --host xxx:27017 --authenticationDatabase admin -u xxx -p xxx

    For more information, see mongodump command documentation.

  2. Import the backup file to ApsaraDB for MongoDB.

    Run the mongostore command based on the backup file created in the previous step to import all data to ApsaraDB for MongoDB. For example, run the following statement to import the entire database:

    1. mongorestore --host dds-xxx:3717 --authenticationDatabase admin -u root -p xxx dump
Thank you! We've received your feedback.