1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/mongorestore.md

21 lines
1 KiB
Markdown
Raw Normal View History

2016-09-06 02:22:20 +05:30
# 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/>.
2016-09-06 02:22:20 +05:30
- Import a BSON data dump from a directory to a MongoDB database:
2016-09-06 02:22:20 +05:30
`mongorestore --db {{database_name}} {{path/to/directory}}`
2016-09-06 02:22:20 +05:30
- 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):
2016-09-06 02:22:20 +05:30
`mongorestore --host {{database_host:port}} --db {{database_name}} --username {{username}} {{path/to/directory}} --password`
2016-09-06 02:22:20 +05:30
- Import a collection from a BSON file to a MongoDB database:
2016-09-06 02:22:20 +05:30
`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):
2016-09-06 02:22:20 +05:30
`mongorestore --host {{database_host:port}} --db {{database_name}} --username {{username}} {{path/to/file}} --password`