返回命令列表

Linux command

mongorestore 命令

文本

Copy it and replace filenames, paths, or keywords as needed.

命令示例

Restore from dump directory

mongorestore [dump/]

Restore specific database

mongorestore --db=[database] [dump/database/]

Restore to remote host

mongorestore --host=[hostname] --port=[27017] [dump/]

Restore with drop

mongorestore --drop [dump/]

Restore from archive

mongorestore --archive=[backup.archive]

说明

mongorestore restores MongoDB data from mongodump output. Part of MongoDB Database Tools. Restores BSON files to MongoDB collections. Supports full and selective restoration.

参数

--db _name_
Target database name.
--collection _name_
Target collection.
--drop
Drop collections before restore.
--host _host_
MongoDB host.
--archive _file_
Restore from archive file.
--gzip
Decompress gzipped input.

FAQ

What is the mongorestore command used for?

mongorestore restores MongoDB data from mongodump output. Part of MongoDB Database Tools. Restores BSON files to MongoDB collections. Supports full and selective restoration.

How do I run a basic mongorestore example?

Run `mongorestore [dump/]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --db _name_ do in mongorestore?

Target database name.