1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-10-30 22:17:57 +01:00
tldr/pages/common/mongorestore.md
2019-06-04 16:29:40 -03:00

1 KiB

mongorestore

Utility to import a collection or database from a binary dump into a MongoDB instance. More information: https://docs.mongodb.com/manual/reference/program/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