mongorestore

Utility to import a collection or database from a binary dump into a MongoDB instance. More information: <https://docs.mongodb.com/database-tools/mongorestore/>.

Install

All systems
curl cmd.cat/mongorestore.sh
Debian Debian
apt-get install mongo-tools
Ubuntu
apt-get install mongo-tools
Alpine
apk add mongodb-tools
Arch Arch Linux
pacman -S mongodb-tools
image/svg+xml Kali Linux
apt-get install mongo-tools
Fedora
dnf install mongo-tools
Windows (WSL2)
sudo apt-get update sudo apt-get install mongo-tools
Raspbian
apt-get install mongo-tools
Docker
docker run cmd.cat/mongorestore mongorestore powered by Commando

Utility to import a collection or database from a binary dump into a MongoDB instance. More information: <https://docs.mongodb.com/database-tools/mongorestore/>.

  • Import a BSON data dump from a directory to a MongoDB database:
    mongorestore --db database_name path/to/directory
  • 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
  • Import a collection from a BSON file to a MongoDB database:
    mongorestore --db database_name path/to/file
  • 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

© tl;dr; authors and contributors