Blame SOURCES/mongorestore.1

334bcc
.\" Man page generated from reStructuredText.
334bcc
.
334bcc
.TH "MONGORESTORE" "1" "January 30, 2015" "3.0" "mongodb-manual"
334bcc
.SH NAME
334bcc
mongorestore \- MongoDB Data Restoration Tool
334bcc
.
334bcc
.nr rst2man-indent-level 0
334bcc
.
334bcc
.de1 rstReportMargin
334bcc
\\$1 \\n[an-margin]
334bcc
level \\n[rst2man-indent-level]
334bcc
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
334bcc
-
334bcc
\\n[rst2man-indent0]
334bcc
\\n[rst2man-indent1]
334bcc
\\n[rst2man-indent2]
334bcc
..
334bcc
.de1 INDENT
334bcc
.\" .rstReportMargin pre:
334bcc
. RS \\$1
334bcc
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
334bcc
. nr rst2man-indent-level +1
334bcc
.\" .rstReportMargin post:
334bcc
..
334bcc
.de UNINDENT
334bcc
. RE
334bcc
.\" indent \\n[an-margin]
334bcc
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
334bcc
.nr rst2man-indent-level -1
334bcc
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
334bcc
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
334bcc
..
334bcc
.SH SYNOPSIS
334bcc
.sp
334bcc
The \fBmongorestore\fP program writes data from a binary database
334bcc
dump created by \fBmongodump\fP to a MongoDB
334bcc
instance. \fBmongorestore\fP can create a new database or add
334bcc
data to an existing database.
334bcc
.sp
334bcc
\fBmongorestore\fP can write data to either \fImongod\fP or \fBmongos\fP
334bcc
instances, in addition to writing directly to MongoDB data files
334bcc
without an active \fBmongod\fP\&.
334bcc
.SH BEHAVIOR
334bcc
.sp
334bcc
If you restore to an existing database, \fBmongorestore\fP will
334bcc
only insert into the existing database, and does not perform updates
334bcc
of any kind. If existing documents have the same value \fB_id\fP field
334bcc
in the target database and collection,
334bcc
\fBmongorestore\fP will \fInot\fP overwrite those documents.
334bcc
.sp
334bcc
Remember the following properties of \fBmongorestore\fP behavior:
334bcc
.INDENT 0.0
334bcc
.IP \(bu 2
334bcc
\fBmongorestore\fP recreates indexes recorded by
334bcc
\fBmongodump\fP\&.
334bcc
.IP \(bu 2
334bcc
all operations are inserts, not updates.
334bcc
.IP \(bu 2
334bcc
\fBmongorestore\fP does not wait for a response from a
334bcc
\fBmongod\fP to ensure that the MongoDB process has received or
334bcc
recorded the operation.
334bcc
.sp
334bcc
The \fBmongod\fP will record any errors to its log that occur
334bcc
during a restore operation, but \fBmongorestore\fP will not
334bcc
receive errors.
334bcc
.UNINDENT
334bcc
.sp
334bcc
The data format used by \fBmongodump\fP from version 2.2 or
334bcc
later is \fIincompatible\fP with earlier versions of \fBmongod\fP\&.
334bcc
Do not use recent versions of \fBmongodump\fP to back up older
334bcc
data stores.
334bcc
.sp
334bcc
New in version 3.0.0: \fBmongorestore\fP also accepts input via standard input.
334bcc
334bcc
.SH REQUIRED ACCESS TO RESTORE USER DATA
334bcc
.sp
334bcc
Changed in version 2.6.
334bcc
334bcc
.sp
334bcc
To restore users and \fIuser\-defined roles\fP on a
334bcc
given database, you must have access to the \fBadmin\fP database. MongoDB
334bcc
stores the user data and role definitions for all databases in the
334bcc
\fBadmin\fP database.
334bcc
.sp
334bcc
Specifically, to restore users to a given database, you must have the
334bcc
\fBinsert\fP \fIaction\fP on the \fBadmin\fP
334bcc
database\(aqs \fBadmin.system.users\fP collection. The \fBrestore\fP
334bcc
role provides this privilege.
334bcc
.sp
334bcc
To restore user\-defined roles to a database, you must have the
334bcc
\fBinsert\fP action on the \fBadmin\fP database\(aqs
334bcc
\fBadmin.system.roles\fP collection. The \fBrestore\fP role
334bcc
provides this privilege.
334bcc
.SH OPTIONS
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B mongorestore
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B mongorestore
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-help
334bcc
Returns information on the options and use of \fBmongorestore\fP\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-verbose, \-v
334bcc
Increases the amount of internal reporting returned on standard output
334bcc
or in log files. Increase the verbosity with the \fB\-v\fP form by
334bcc
including the option multiple times, (e.g. \fB\-vvvvv\fP\&.)
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-quiet
334bcc
Runs the \fBmongorestore\fP in a quiet mode that attempts to limit the amount
334bcc
of output.
334bcc
.sp
334bcc
This option suppresses:
334bcc
.INDENT 7.0
334bcc
.IP \(bu 2
334bcc
output from \fIdatabase commands\fP
334bcc
.IP \(bu 2
334bcc
replication activity
334bcc
.IP \(bu 2
334bcc
connection accepted events
334bcc
.IP \(bu 2
334bcc
connection closed events
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-version
334bcc
Returns the \fBmongorestore\fP release number.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-host <hostname><:port>, \-h <hostname><:port>
334bcc
\fIDefault\fP: localhost:27017
334bcc
.sp
334bcc
Specifies a resolvable hostname for the \fBmongod\fP to which to
334bcc
connect. By default, the \fBmongorestore\fP attempts to connect to a MongoDB
334bcc
instance running on the localhost on port number \fB27017\fP\&.
334bcc
.sp
334bcc
To connect to a replica set, specify the
334bcc
\fBreplSetName\fP and a seed list of set members, as in
334bcc
the following:
334bcc
.INDENT 7.0
334bcc
.INDENT 3.5
334bcc
.sp
334bcc
.nf
334bcc
.ft C
334bcc
<replSetName>/<hostname1><:port>,<hostname2><:port>,<...>
334bcc
.ft P
334bcc
.fi
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.sp
334bcc
You can always connect directly to a single MongoDB instance by
334bcc
specifying the host and port number directly.
334bcc
.sp
334bcc
Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must
334bcc
enclose the portion of an address and port combination in
334bcc
brackets (e.g. \fB[<address>]\fP).
334bcc
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-port <port>
334bcc
\fIDefault\fP: 27017
334bcc
.sp
334bcc
Specifies the TCP port on which the MongoDB instance listens for
334bcc
client connections.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-ipv6
334bcc
Enables IPv6 support and allows the \fBmongorestore\fP to connect to the
334bcc
MongoDB instance using an IPv6 network. All MongoDB programs and
334bcc
processes disable IPv6 support by default.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-ssl
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Enables connection to a \fBmongod\fP or \fBmongos\fP that has
334bcc
SSL support enabled.
334bcc
.sp
334bcc
The default distribution of MongoDB does not contain support for SSL.
334bcc
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-sslCAFile <filename>
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Specifies the \fB\&.pem\fP file that contains the root certificate chain
334bcc
from the Certificate Authority. Specify the file name of the
334bcc
\fB\&.pem\fP file using relative or absolute paths.
334bcc
.sp
334bcc
The default distribution of MongoDB does not contain support for SSL.
334bcc
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
334bcc
.sp
334bcc
\fBWARNING:\fP
334bcc
.INDENT 7.0
334bcc
.INDENT 3.5
334bcc
If the \fBmongo\fP shell or any other tool that connects to
334bcc
\fBmongos\fP or \fBmongod\fP is run without
334bcc
\fI\-\-sslCAFile\fP, it will not attempt to validate
334bcc
server certificates. This results in vulnerability to expired
334bcc
\fBmongod\fP and \fBmongos\fP certificates as well as to foreign
334bcc
processes posing as valid \fBmongod\fP or \fBmongos\fP
334bcc
instances. Ensure that you \fIalways\fP specify the CA file against which
334bcc
server certificates should be validated in cases where intrusion is a
334bcc
possibility.
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-sslPEMKeyFile <filename>
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Specifies the \fB\&.pem\fP file that contains both the SSL certificate
334bcc
and key. Specify the file name of the \fB\&.pem\fP file using relative
334bcc
or absolute paths.
334bcc
.sp
334bcc
This option is required when using the \fI\-\-ssl\fP option to connect
334bcc
to a \fBmongod\fP or \fBmongos\fP that has
334bcc
\fBCAFile\fP enabled \fIwithout\fP
334bcc
\fBallowConnectionsWithoutCertificates\fP\&.
334bcc
.sp
334bcc
The default distribution of MongoDB does not contain support for SSL.
334bcc
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-sslPEMKeyPassword <value>
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Specifies the password to de\-crypt the certificate\-key file (i.e.
334bcc
\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the
334bcc
certificate\-key file is encrypted. In all cases, the \fBmongorestore\fP will
334bcc
redact the password from all logging and reporting output.
334bcc
.sp
334bcc
If the private key in the PEM file is encrypted and you do not specify
334bcc
the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongorestore\fP will prompt for a passphrase. See
334bcc
\fIssl\-certificate\-password\fP\&.
334bcc
.sp
334bcc
The default distribution of MongoDB does not contain support for SSL.
334bcc
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-sslCRLFile <filename>
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Specifies the \fB\&.pem\fP file that contains the Certificate Revocation
334bcc
List. Specify the file name of the \fB\&.pem\fP file using relative or
334bcc
absolute paths.
334bcc
.sp
334bcc
The default distribution of MongoDB does not contain support for SSL.
334bcc
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-sslAllowInvalidCertificates
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Bypasses the validation checks for server certificates and allows
334bcc
the use of invalid certificates. When using the
334bcc
\fBallowInvalidCertificates\fP setting, MongoDB logs as a
334bcc
warning the use of the invalid certificate.
334bcc
.sp
334bcc
The default distribution of MongoDB does not contain support for SSL.
334bcc
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-sslAllowInvalidHostnames
334bcc
New in version 3.0.
334bcc
334bcc
.sp
334bcc
Disables the validation of the hostnames in SSL certificates. Allows
334bcc
\fBmongorestore\fP to connect to MongoDB instances if the hostname their
334bcc
certificates do not match the specified hostname.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-sslFIPSMode
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Directs the \fBmongorestore\fP to use the FIPS mode of the installed OpenSSL
334bcc
library. Your system must have a FIPS compliant OpenSSL library to use
334bcc
the \fI\-\-sslFIPSMode\fP option.
334bcc
.sp
334bcc
\fBNOTE:\fP
334bcc
.INDENT 7.0
334bcc
.INDENT 3.5
334bcc
FIPS Compatible SSL is
334bcc
available only in \fI\%MongoDB Enterprise\fP\&. See
334bcc
http://docs.mongodb.org/manual/tutorial/configure\-fips for more information.
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-username <username>, \-u <username>
334bcc
Specifies a username with which to authenticate to a MongoDB database
334bcc
that uses authentication. Use in conjunction with the \fB\-\-password\fP and
334bcc
\fB\-\-authenticationDatabase\fP options.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-password <password>, \-p <password>
334bcc
Specifies a password with which to authenticate to a MongoDB database
334bcc
that uses authentication. Use in conjunction with the \fB\-\-username\fP and
334bcc
\fB\-\-authenticationDatabase\fP options.
334bcc
.sp
334bcc
If you do not specify an argument for \fI\-\-password\fP, \fBmongorestore\fP will
334bcc
prompt interactively for a password on the console.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-authenticationDatabase <dbname>
334bcc
New in version 2.4.
334bcc
334bcc
.sp
334bcc
Specifies the database that holds the user\(aqs credentials.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-authenticationMechanism <name>
334bcc
\fIDefault\fP: MONGODB\-CR
334bcc
.sp
334bcc
New in version 2.4.
334bcc
334bcc
.sp
334bcc
Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication
334bcc
mechanisms.
334bcc
334bcc
.sp
334bcc
Specifies the authentication mechanism the \fBmongorestore\fP instance uses to
334bcc
authenticate to the \fBmongod\fP or \fBmongos\fP\&.
334bcc
.TS
334bcc
center;
334bcc
|l|l|.
334bcc
_
334bcc
T{
334bcc
Value
334bcc
T}	T{
334bcc
Description
334bcc
T}
334bcc
_
334bcc
T{
334bcc
MONGODB\-CR
334bcc
T}	T{
334bcc
MongoDB challenge/response authentication.
334bcc
T}
334bcc
_
334bcc
T{
334bcc
MONGODB\-X509
334bcc
T}	T{
334bcc
MongoDB SSL certificate authentication.
334bcc
T}
334bcc
_
334bcc
T{
334bcc
PLAIN
334bcc
T}	T{
334bcc
External authentication using LDAP. You can also use \fBPLAIN\fP
334bcc
for authenticating in\-database users. \fBPLAIN\fP transmits
334bcc
passwords in plain text. This mechanism is available only in
334bcc
\fI\%MongoDB Enterprise\fP\&.
334bcc
T}
334bcc
_
334bcc
T{
334bcc
GSSAPI
334bcc
T}	T{
334bcc
External authentication using Kerberos. This mechanism is
334bcc
available only in \fI\%MongoDB Enterprise\fP\&.
334bcc
T}
334bcc
_
334bcc
.TE
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-gssapiServiceName
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the
334bcc
default name of \fBmongodb\fP\&.
334bcc
.sp
334bcc
This option is available only in MongoDB Enterprise.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-gssapiHostName
334bcc
New in version 2.6.
334bcc
334bcc
.sp
334bcc
Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does
334bcc
not match the hostname resolved by DNS.
334bcc
.sp
334bcc
This option is available only in MongoDB Enterprise.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-db <database>, \-d <database>
334bcc
Specifies a database for \fBmongorestore\fP to restore data \fIinto\fP\&.
334bcc
If the database does not exist, \fBmongorestore\fP creates the
334bcc
database. If you do not specify a \fB<db>\fP, \fBmongorestore\fP
334bcc
creates new databases that correspond to the databases where data
334bcc
originated and data may be overwritten. Use this option to restore data
334bcc
into a MongoDB instance that already has data.
334bcc
.sp
334bcc
\fI\%\-\-db\fP does \fInot\fP control which \fIBSON\fP files
334bcc
\fBmongorestore\fP restores. You must use the
334bcc
\fBmongorestore\fP \fI\%path option\fP to
334bcc
limit that restored data.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-collection <collection>, \-c <collection>
334bcc
Specifies a single collection for \fBmongorestore\fP to restore. If
334bcc
you do not specify \fI\%\-\-collection\fP, \fBmongorestore\fP takes
334bcc
the collection name from the input filename. If the input file has an
334bcc
extension, MongoDB omits the extension of the file from the collection
334bcc
name.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-objcheck
334bcc
Forces \fBmongorestore\fP to validate all requests from clients
334bcc
upon receipt to ensure that clients never insert invalid documents into
334bcc
the database. For objects with a high degree of sub\-document nesting,
334bcc
\fI\-\-objcheck\fP can have a small impact on performance. You can set
334bcc
\fI\%\-\-noobjcheck\fP to disable object checking at run\-time.
334bcc
.sp
334bcc
Changed in version 2.4: MongoDB enables \fI\-\-objcheck\fP by default, to prevent any
334bcc
client from inserting malformed or invalid BSON into a MongoDB
334bcc
database.
334bcc
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-noobjcheck
334bcc
New in version 2.4.
334bcc
334bcc
.sp
334bcc
Disables the default document validation that MongoDB performs on all
334bcc
incoming BSON documents.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-drop
334bcc
Modifies the restoration procedure to drop every collection from the
334bcc
target database before restoring the collection from the dumped backup.
334bcc
.sp
334bcc
With \fI\%\-\-drop\fP specified, \fBmongorestore\fP removes all user
334bcc
credentials and replaces them with users defined in the dump
334bcc
file. Therefore, in systems with \fBauthorization\fP
334bcc
enabled, \fBmongorestore\fP must be able to authenticate to an existing
334bcc
user \fIand\fP to a user defined in the dump file. If \fBmongorestore\fP can\(aqt
334bcc
authenticate to a user defined in the dump file, the restoration
334bcc
process will fail, leaving an empty database.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-oplogReplay
334bcc
Replays the \fIoplog\fP after restoring the dump to ensure that the
334bcc
current state of the database reflects the point\-in\-time backup captured
334bcc
with the "\fImongodump \-\-oplog\fP" command. For an example of
334bcc
\fI\%\-\-oplogReplay\fP, see \fIbackup\-restore\-oplogreplay\fP\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-oplogLimit <timestamp>
334bcc
New in version 2.2.
334bcc
334bcc
.sp
334bcc
Prevents \fBmongorestore\fP from applying \fIoplog\fP entries
334bcc
with timestamp newer than or equal to \fB<timestamp>\fP\&. Specify
334bcc
\fB<timestamp>\fP values in the form of \fB<time_t>:<ordinal>\fP, where
334bcc
\fB<time_t>\fP is the seconds since the UNIX epoch, and \fB<ordinal>\fP
334bcc
represents a counter of operations in the oplog that occurred in the
334bcc
specified second.
334bcc
.sp
334bcc
You must use \fI\%\-\-oplogLimit\fP in conjunction with the
334bcc
\fI\%\-\-oplogReplay\fP option.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-keepIndexVersion
334bcc
Prevents \fBmongorestore\fP from upgrading the index to the latest
334bcc
version during the restoration process.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-noIndexRestore
334bcc
New in version 2.2.
334bcc
334bcc
.sp
334bcc
Prevents \fBmongorestore\fP from restoring and building indexes as
334bcc
specified in the corresponding \fBmongodump\fP output.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-noOptionsRestore
334bcc
New in version 2.2.
334bcc
334bcc
.sp
334bcc
Prevents \fBmongorestore\fP from setting the collection options,
334bcc
such as those specified by the \fBcollMod\fP \fIdatabase
334bcc
command\fP, on restored collections.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-restoreDbUsersAndRoles
334bcc
Restore user and role definitions for the given database. See
334bcc
http://docs.mongodb.org/manual/reference/system\-roles\-collection and
334bcc
http://docs.mongodb.org/manual/reference/system\-users\-collection for more information.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-w <number of replicas per write>
334bcc
New in version 2.2.
334bcc
334bcc
.sp
334bcc
Specifies the \fIwrite concern\fP for each write operation that
334bcc
\fBmongorestore\fP writes to the target database. By default,
334bcc
\fBmongorestore\fP does not wait for a response for \fIwrite
334bcc
acknowledgment\fP\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-writeConcern <document>
334bcc
\fIDefault\fP: majority
334bcc
.sp
334bcc
Specifies the \fIwrite concern\fP for each write operation that \fBmongorestore\fP
334bcc
writes to the target database.
334bcc
.sp
334bcc
Specify the write concern as a document with \fIw options\fP\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-maintainInsertionOrder
334bcc
\fIDefault\fP: False
334bcc
.sp
334bcc
If specified, \fBmongorestore\fP inserts the documents in the order of
334bcc
their appearance in the input source, otherwise \fBmongorestore\fP may
334bcc
perform the insertions in an arbitrary order.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-numParallelCollections int, \-j int
334bcc
\fIDefault\fP: 4
334bcc
.sp
334bcc
Number of collections \fBmongorestore\fP should restore
334bcc
in parallel.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B <path>
334bcc
The final argument of the \fBmongorestore\fP command is a
334bcc
directory path. This argument specifies the location of the
334bcc
database dump from which to restore.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-dir string
334bcc
Specifies the dump directory.
334bcc
.UNINDENT
334bcc
.SH USE
334bcc
.sp
334bcc
See http://docs.mongodb.org/manual/tutorial/backup\-with\-mongodump
334bcc
for a larger overview of \fBmongorestore\fP
334bcc
usage. Also see the \fBmongodump\fP document for an overview of the
334bcc
\fBmongodump\fP, which provides the related inverse
334bcc
functionality.
334bcc
.sp
334bcc
Consider the following example:
334bcc
.INDENT 0.0
334bcc
.INDENT 3.5
334bcc
.sp
334bcc
.nf
334bcc
.ft C
334bcc
mongorestore \-\-collection people \-\-db accounts dump/accounts/people.bson
334bcc
.ft P
334bcc
.fi
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.sp
334bcc
Here, \fBmongorestore\fP reads the database dump in the \fBdump/\fP
334bcc
sub\-directory of the current directory, and restores \fIonly\fP the
334bcc
documents in the collection named \fBpeople\fP from the database named
334bcc
\fBaccounts\fP\&. \fBmongorestore\fP restores data to the instance
334bcc
running on the localhost interface on port \fB27017\fP\&.
334bcc
.sp
334bcc
In the final example, \fBmongorestore\fP restores a database
334bcc
dump located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, to a database
334bcc
running on port \fB37017\fP on the host
334bcc
\fBmongodb1.example.net\fP\&. The \fBmongorestore\fP command authenticates to
334bcc
the MongoDB instance using the username \fBuser\fP and the
334bcc
password \fBpass\fP, as follows:
334bcc
.INDENT 0.0
334bcc
.INDENT 3.5
334bcc
.sp
334bcc
.nf
334bcc
.ft C
334bcc
mongorestore \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass /opt/backup/mongodump\-2011\-10\-24
334bcc
.ft P
334bcc
.fi
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.sp
334bcc
You can also \fIpipe\fP data directly into to \fBmongorestore\fP
334bcc
through standard input, as in the following example:
334bcc
.INDENT 0.0
334bcc
.INDENT 3.5
334bcc
.sp
334bcc
.nf
334bcc
.ft C
334bcc
zcat /opt/backup/mongodump\-2014\-12\-03/accounts.people.bson.gz | mongorestore \-\-collection people \-\-db accounts
334bcc
.ft P
334bcc
.fi
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.SH AUTHOR
334bcc
MongoDB Documentation Project
334bcc
.SH COPYRIGHT
334bcc
2011-2015
334bcc
.\" Generated by docutils manpage writer.
334bcc
.