Forrest logo
back to the mongorestore tool

mongorestore:tldr:7689d

mongorestore: Import a BSON data dump from a directory to a given database in a MongoDB server host, running at a given port, with user authentication (user will be prompted for password).
$ mongorestore --host ${database_host:port} --db ${database_name} --username ${username} ${path-to-directory} --password
try on your machine

The command mongorestore is used to restore a previously backed up MongoDB database or collection.

Here's the breakdown of the command you provided:

  • mongorestore: The actual command to restore a MongoDB database.
  • --host ${database_host:port}: Specifies the host and port where the MongoDB instance is running. ${database_host:port} is the placeholder for the actual host and port values.
  • --db ${database_name}: Specifies the name of the database to restore. ${database_name} is the placeholder for the actual database name.
  • --username ${username}: Specifies the username for authentication. ${username} is the placeholder for the actual username.
  • ${path-to-directory}: Specifies the path to the directory where the database backup files are located.
  • --password: This option is not included in the command you provided. It should be followed by the actual password for authentication.

To use this command, you need to replace the placeholder values with the appropriate values specific to your MongoDB setup.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mongorestore tool