LinuxCommandLibrary

mongorestore

mongorestore

TLDR

Import a BSON data dump from a directory to a MongoDB database

$ mongorestore --db [database_name] [path/to/directory]
copy


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
copy


Import a collection from a BSON file to a MongoDB database
$ mongorestore --db [database_name] [path/to/file]
copy


Import a collection from a BSON file 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/file] --password
copy

SYNOPSIS

mongorestore [options] [directory or file to restore]

DESCRIPTION

The mongorestore program allows restoring backups obtained using mongodump(1) into a running MongoDB instance. By default it will restore all data in the specified file or directory, but limitting by database and collection is possible.

OPTIONS

See mongorestore --help for a list supported options and their descriptions.

SEE ALSO

mongodump(1) The full documentation of mongorestore can be found at https://docs.mongodb.com/manual/reference/program/mongorestore/.

AUTHOR

mongorestore was written by MongoDB, Inc. and is licensed under the Apache License, Version 2.0.

This manpage was written by Apollon Oikonomopoulos <apoikos@debian.org> for the Debian project (but may be used by others).

Copied to clipboard