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

  • Utility to import a collection or database from a binary dump into a MongoDB instance.
    More information: <https://docs.mongodb.com/database-tools/mongorestore/>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

mongorestore --host {{database_host:port}} --db {{database_name}} --username {{username}} {{path/to/directory}} --password

click the source code to copy install mongorestore on any operating system with command-not-found.com