Blame SOURCES/mongodump.1

7fe184
.\" Man page generated from reStructuredText.
7fe184
.
7fe184
.TH "MONGODUMP" "1" "January 30, 2015" "3.0" "mongodb-manual"
7fe184
.SH NAME
7fe184
mongodump \- MongoDB Data Dump Utility
7fe184
.
7fe184
.nr rst2man-indent-level 0
7fe184
.
7fe184
.de1 rstReportMargin
7fe184
\\$1 \\n[an-margin]
7fe184
level \\n[rst2man-indent-level]
7fe184
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
7fe184
-
7fe184
\\n[rst2man-indent0]
7fe184
\\n[rst2man-indent1]
7fe184
\\n[rst2man-indent2]
7fe184
..
7fe184
.de1 INDENT
7fe184
.\" .rstReportMargin pre:
7fe184
. RS \\$1
7fe184
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
7fe184
. nr rst2man-indent-level +1
7fe184
.\" .rstReportMargin post:
7fe184
..
7fe184
.de UNINDENT
7fe184
. RE
7fe184
.\" indent \\n[an-margin]
7fe184
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
7fe184
.nr rst2man-indent-level -1
7fe184
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
7fe184
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
7fe184
..
7fe184
.SH SYNOPSIS
7fe184
.sp
7fe184
\fBmongodump\fP is a utility for creating a binary export of the
7fe184
contents of a database. Consider using this utility as part of an
7fe184
effective \fBbackup strategy\fP\&. Use
7fe184
\fBmongodump\fP in conjunction with \fBmongorestore\fP to
7fe184
restore databases.
7fe184
.sp
7fe184
\fBmongodump\fP can read data from either \fBmongod\fP or \fBmongos\fP
7fe184
instances, in addition to reading directly from MongoDB data files
7fe184
without an active \fBmongod\fP\&.
7fe184
.sp
7fe184
\fBSEE ALSO:\fP
7fe184
.INDENT 0.0
7fe184
.INDENT 3.5
7fe184
\fBmongorestore\fP,
7fe184
http://docs.mongodb.org/manual/tutorial/backup\-sharded\-cluster\-with\-database\-dumps
7fe184
and http://docs.mongodb.org/manual/core/backups\&.
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.SH BEHAVIOR
7fe184
.sp
7fe184
\fBmongodump\fP does \fInot\fP dump the content of the \fBlocal\fP database.
7fe184
.sp
7fe184
The data format used by \fBmongodump\fP from version 2.2 or
7fe184
later is \fIincompatible\fP with earlier versions of \fBmongod\fP\&.
7fe184
Do not use recent versions of \fBmongodump\fP to back up older
7fe184
data stores.
7fe184
.sp
7fe184
When running \fBmongodump\fP against a \fBmongos\fP instance
7fe184
where the \fIsharded cluster\fP consists of \fIreplica sets\fP, the \fIread preference\fP of the operation will prefer reads
7fe184
from \fIsecondary\fP members of the set.
7fe184
.sp
7fe184
Changed in version 2.2: When used in combination with \fBfsync\fP or
7fe184
\fBdb.fsyncLock()\fP, \fBmongod\fP will block
7fe184
reads, including those from \fBmongodump\fP, when
7fe184
queued write operation waits behind the \fBfsync\fP
7fe184
lock. Do not use \fBmongodump\fP with
7fe184
\fBdb.fsyncLock()\fP\&.
7fe184
7fe184
.sp
7fe184
\fBmongodump\fP overwrites output files if they exist in the
7fe184
backup data folder. Before running the \fBmongodump\fP command
7fe184
multiple times, either ensure that you no longer need the files in the
7fe184
output folder (the default is the \fBdump/\fP folder) or rename the
7fe184
folders or files.
7fe184
.SH REQUIRED ACCESS
7fe184
.SS Backup Collections
7fe184
.sp
7fe184
To backup all the databases in a cluster via \fBmongodump\fP, you
7fe184
should have the \fBbackup\fP role. The \fBbackup\fP role provides
7fe184
the required privileges for backing up all databases. The role confers no
7fe184
additional access, in keeping with the policy of \fIleast privilege\fP\&.
7fe184
.sp
7fe184
To backup a given database, you must have \fBread\fP access on the database.
7fe184
Several roles provide this access, including the \fBbackup\fP role.
7fe184
.sp
7fe184
To backup the \fBsystem.profile\fP
7fe184
collection, which is created when you activate \fIdatabase profiling\fP, you must have \fBadditional\fP
7fe184
\fBread\fP access on this collection. Several
7fe184
roles provide this access, including the \fBclusterAdmin\fP and
7fe184
\fBdbAdmin\fP roles.
7fe184
.SS Backup Users
7fe184
.sp
7fe184
Changed in version 2.6.
7fe184
7fe184
.sp
7fe184
To backup users and \fIuser\-defined roles\fP for a
7fe184
given database, you must have access to the \fBadmin\fP database. MongoDB
7fe184
stores the user data and role definitions for all databases in the
7fe184
\fBadmin\fP database.
7fe184
.sp
7fe184
Specifically, to backup a given database\(aqs users, you must have the
7fe184
\fBfind\fP \fIaction\fP on the \fBadmin\fP
7fe184
database\(aqs \fBadmin.system.users\fP collection. The \fBbackup\fP
7fe184
and \fBuserAdminAnyDatabase\fP roles both provide this privilege.
7fe184
.sp
7fe184
To backup the user\-defined roles on a database, you must have the
7fe184
\fBfind\fP action on the \fBadmin\fP database\(aqs
7fe184
\fBadmin.system.roles\fP collection. Both the \fBbackup\fP and
7fe184
\fBuserAdminAnyDatabase\fP roles provide this privilege.
7fe184
.SH OPTIONS
7fe184
.sp
7fe184
Changed in version 3.0.0: \fBmongodump\fP removed the \fB\-\-dbpath\fP as well as related
7fe184
\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. You must use
7fe184
\fBmongodump\fP while connected to a \fBmongod\fP instance.
7fe184
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B mongodump
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B mongodump
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-help
7fe184
Returns information on the options and use of \fBmongodump\fP\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-verbose, \-v
7fe184
Increases the amount of internal reporting returned on standard output
7fe184
or in log files. Increase the verbosity with the \fB\-v\fP form by
7fe184
including the option multiple times, (e.g. \fB\-vvvvv\fP\&.)
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-quiet
7fe184
Runs the \fBmongodump\fP in a quiet mode that attempts to limit the amount
7fe184
of output.
7fe184
.sp
7fe184
This option suppresses:
7fe184
.INDENT 7.0
7fe184
.IP \(bu 2
7fe184
output from \fIdatabase commands\fP
7fe184
.IP \(bu 2
7fe184
replication activity
7fe184
.IP \(bu 2
7fe184
connection accepted events
7fe184
.IP \(bu 2
7fe184
connection closed events
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-version
7fe184
Returns the \fBmongodump\fP release number.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-host <hostname><:port>, \-h <hostname><:port>
7fe184
\fIDefault\fP: localhost:27017
7fe184
.sp
7fe184
Specifies a resolvable hostname for the \fBmongod\fP to which to
7fe184
connect. By default, the \fBmongodump\fP attempts to connect to a MongoDB
7fe184
instance running on the localhost on port number \fB27017\fP\&.
7fe184
.sp
7fe184
To connect to a replica set, specify the
7fe184
\fBreplSetName\fP and a seed list of set members, as in
7fe184
the following:
7fe184
.INDENT 7.0
7fe184
.INDENT 3.5
7fe184
.sp
7fe184
.nf
7fe184
.ft C
7fe184
<replSetName>/<hostname1><:port>,<hostname2><:port>,<...>
7fe184
.ft P
7fe184
.fi
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.sp
7fe184
You can always connect directly to a single MongoDB instance by
7fe184
specifying the host and port number directly.
7fe184
.sp
7fe184
Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must
7fe184
enclose the portion of an address and port combination in
7fe184
brackets (e.g. \fB[<address>]\fP).
7fe184
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-port <port>
7fe184
\fIDefault\fP: 27017
7fe184
.sp
7fe184
Specifies the TCP port on which the MongoDB instance listens for
7fe184
client connections.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-ipv6
7fe184
Enables IPv6 support and allows the \fBmongodump\fP to connect to the
7fe184
MongoDB instance using an IPv6 network. All MongoDB programs and
7fe184
processes disable IPv6 support by default.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-ssl
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Enables connection to a \fBmongod\fP or \fBmongos\fP that has
7fe184
SSL support enabled.
7fe184
.sp
7fe184
The default distribution of MongoDB does not contain support for SSL.
7fe184
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-sslCAFile <filename>
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Specifies the \fB\&.pem\fP file that contains the root certificate chain
7fe184
from the Certificate Authority. Specify the file name of the
7fe184
\fB\&.pem\fP file using relative or absolute paths.
7fe184
.sp
7fe184
The default distribution of MongoDB does not contain support for SSL.
7fe184
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
7fe184
.sp
7fe184
\fBWARNING:\fP
7fe184
.INDENT 7.0
7fe184
.INDENT 3.5
7fe184
If the \fBmongo\fP shell or any other tool that connects to
7fe184
\fBmongos\fP or \fBmongod\fP is run without
7fe184
\fI\-\-sslCAFile\fP, it will not attempt to validate
7fe184
server certificates. This results in vulnerability to expired
7fe184
\fBmongod\fP and \fBmongos\fP certificates as well as to foreign
7fe184
processes posing as valid \fBmongod\fP or \fBmongos\fP
7fe184
instances. Ensure that you \fIalways\fP specify the CA file against which
7fe184
server certificates should be validated in cases where intrusion is a
7fe184
possibility.
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-sslPEMKeyFile <filename>
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Specifies the \fB\&.pem\fP file that contains both the SSL certificate
7fe184
and key. Specify the file name of the \fB\&.pem\fP file using relative
7fe184
or absolute paths.
7fe184
.sp
7fe184
This option is required when using the \fI\-\-ssl\fP option to connect
7fe184
to a \fBmongod\fP or \fBmongos\fP that has
7fe184
\fBCAFile\fP enabled \fIwithout\fP
7fe184
\fBallowConnectionsWithoutCertificates\fP\&.
7fe184
.sp
7fe184
The default distribution of MongoDB does not contain support for SSL.
7fe184
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-sslPEMKeyPassword <value>
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Specifies the password to de\-crypt the certificate\-key file (i.e.
7fe184
\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the
7fe184
certificate\-key file is encrypted. In all cases, the \fBmongodump\fP will
7fe184
redact the password from all logging and reporting output.
7fe184
.sp
7fe184
If the private key in the PEM file is encrypted and you do not specify
7fe184
the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongodump\fP will prompt for a passphrase. See
7fe184
\fIssl\-certificate\-password\fP\&.
7fe184
.sp
7fe184
The default distribution of MongoDB does not contain support for SSL.
7fe184
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-sslCRLFile <filename>
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Specifies the \fB\&.pem\fP file that contains the Certificate Revocation
7fe184
List. Specify the file name of the \fB\&.pem\fP file using relative or
7fe184
absolute paths.
7fe184
.sp
7fe184
The default distribution of MongoDB does not contain support for SSL.
7fe184
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-sslAllowInvalidCertificates
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Bypasses the validation checks for server certificates and allows
7fe184
the use of invalid certificates. When using the
7fe184
\fBallowInvalidCertificates\fP setting, MongoDB logs as a
7fe184
warning the use of the invalid certificate.
7fe184
.sp
7fe184
The default distribution of MongoDB does not contain support for SSL.
7fe184
For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure\-ssl\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-sslAllowInvalidHostnames
7fe184
New in version 3.0.
7fe184
7fe184
.sp
7fe184
Disables the validation of the hostnames in SSL certificates. Allows
7fe184
\fBmongodump\fP to connect to MongoDB instances if the hostname their
7fe184
certificates do not match the specified hostname.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-sslFIPSMode
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Directs the \fBmongodump\fP to use the FIPS mode of the installed OpenSSL
7fe184
library. Your system must have a FIPS compliant OpenSSL library to use
7fe184
the \fI\-\-sslFIPSMode\fP option.
7fe184
.sp
7fe184
\fBNOTE:\fP
7fe184
.INDENT 7.0
7fe184
.INDENT 3.5
7fe184
FIPS Compatible SSL is
7fe184
available only in \fI\%MongoDB Enterprise\fP\&. See
7fe184
http://docs.mongodb.org/manual/tutorial/configure\-fips for more information.
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-username <username>, \-u <username>
7fe184
Specifies a username with which to authenticate to a MongoDB database
7fe184
that uses authentication. Use in conjunction with the \fB\-\-password\fP and
7fe184
\fB\-\-authenticationDatabase\fP options.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-password <password>, \-p <password>
7fe184
Specifies a password with which to authenticate to a MongoDB database
7fe184
that uses authentication. Use in conjunction with the \fB\-\-username\fP and
7fe184
\fB\-\-authenticationDatabase\fP options.
7fe184
.sp
7fe184
If you do not specify an argument for \fI\-\-password\fP, \fBmongodump\fP will
7fe184
prompt interactively for a password on the console.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-authenticationDatabase <dbname>
7fe184
If you do not specify an authentication database, \fBmongodump\fP
7fe184
assumes that the database specified to export holds the user\(aqs credentials.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-authenticationMechanism <name>
7fe184
\fIDefault\fP: MONGODB\-CR
7fe184
.sp
7fe184
New in version 2.4.
7fe184
7fe184
.sp
7fe184
Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication
7fe184
mechanisms.
7fe184
7fe184
.sp
7fe184
Specifies the authentication mechanism the \fBmongodump\fP instance uses to
7fe184
authenticate to the \fBmongod\fP or \fBmongos\fP\&.
7fe184
.TS
7fe184
center;
7fe184
|l|l|.
7fe184
_
7fe184
T{
7fe184
Value
7fe184
T}	T{
7fe184
Description
7fe184
T}
7fe184
_
7fe184
T{
7fe184
MONGODB\-CR
7fe184
T}	T{
7fe184
MongoDB challenge/response authentication.
7fe184
T}
7fe184
_
7fe184
T{
7fe184
MONGODB\-X509
7fe184
T}	T{
7fe184
MongoDB SSL certificate authentication.
7fe184
T}
7fe184
_
7fe184
T{
7fe184
PLAIN
7fe184
T}	T{
7fe184
External authentication using LDAP. You can also use \fBPLAIN\fP
7fe184
for authenticating in\-database users. \fBPLAIN\fP transmits
7fe184
passwords in plain text. This mechanism is available only in
7fe184
\fI\%MongoDB Enterprise\fP\&.
7fe184
T}
7fe184
_
7fe184
T{
7fe184
GSSAPI
7fe184
T}	T{
7fe184
External authentication using Kerberos. This mechanism is
7fe184
available only in \fI\%MongoDB Enterprise\fP\&.
7fe184
T}
7fe184
_
7fe184
.TE
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-gssapiServiceName
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the
7fe184
default name of \fBmongodb\fP\&.
7fe184
.sp
7fe184
This option is available only in MongoDB Enterprise.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-gssapiHostName
7fe184
New in version 2.6.
7fe184
7fe184
.sp
7fe184
Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does
7fe184
not match the hostname resolved by DNS.
7fe184
.sp
7fe184
This option is available only in MongoDB Enterprise.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-db <database>, \-d <database>
7fe184
Specifies a database to backup. If you do not specify a database,
7fe184
\fBmongodump\fP copies all databases in this instance into the dump
7fe184
files.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-collection <collection>, \-c <collection>
7fe184
Specifies a collection to backup. If you do not specify a collection,
7fe184
this option copies all collections in the specified database or instance
7fe184
to the dump files.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-query <json>, \-q <json>
7fe184
Provides a \fIJSON document\fP as a query that optionally limits the
7fe184
documents included in the output of \fBmongodump\fP\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-forceTableScan
7fe184
Forces \fBmongodump\fP to scan the data store directly: typically,
7fe184
\fBmongodump\fP saves entries as they appear in the index of
7fe184
the \fB_id\fP field. If you specify a query \fI\-\-query\fP,
7fe184
\fBmongodump\fP will use the most appropriate index to support that query.
7fe184
.sp
7fe184
Use \fI\-\-forceTableScan\fP to skip the index and scan the data directly. Typically
7fe184
there are two cases where this behavior is preferable to the
7fe184
default:
7fe184
.INDENT 7.0
7fe184
.IP 1. 3
7fe184
If you have key sizes over 800 bytes that would not be present in the
7fe184
\fB_id\fP index.
7fe184
.IP 2. 3
7fe184
Your database uses a custom \fB_id\fP field.
7fe184
.UNINDENT
7fe184
.sp
7fe184
When you run with \fI\-\-forceTableScan\fP, \fBmongodump\fP does
7fe184
not use \fB$snapshot\fP\&. As a result, the dump produced by
7fe184
\fBmongodump\fP can reflect the state of the database at many
7fe184
different points in time.
7fe184
.sp
7fe184
\fBIMPORTANT:\fP
7fe184
.INDENT 7.0
7fe184
.INDENT 3.5
7fe184
Use \fI\-\-forceTableScan\fP with extreme caution and
7fe184
consideration.
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-out <path>, \-o <path>
7fe184
Specifies the directory where \fBmongodump\fP will write
7fe184
\fIBSON\fP files for the dumped databases. By default,
7fe184
\fBmongodump\fP saves output files in a directory named
7fe184
\fBdump\fP in the current working directory.
7fe184
.sp
7fe184
To send the database dump to standard output, specify "\fB\-\fP" instead of
7fe184
a path. Write to standard output if you want process the output before
7fe184
saving it, such as to use \fBgzip\fP to compress the dump. When writing
7fe184
standard output, \fBmongodump\fP does not write the metadata that
7fe184
writes in a \fB<dbname>.metadata.json\fP file when writing to files
7fe184
directly.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-repair
7fe184
Runs a repair option in addition to dumping the
7fe184
database. The repair option changes the behavior of \fBmongodump\fP to
7fe184
only write valid data and exclude data that may be in
7fe184
an invalid state as a result of an improper shutdown or
7fe184
\fBmongod\fP crash.
7fe184
.sp
7fe184
The \fI\%\-\-repair\fP option uses aggressive data\-recovery algorithms
7fe184
that may produce a large amount of duplication.
7fe184
.sp
7fe184
\fI\%\-\-repair\fP is only available for use with \fBmongod\fP
7fe184
instances using the \fBmmapv1\fP storage engine. You cannot run
7fe184
\fI\%\-\-repair\fP with \fBmongos\fP or with \fBmongod\fP instances
7fe184
that use the \fBwiredTiger\fP storage engine. To repair data in a
7fe184
\fBmongod\fP instance using \fBwiredTiger\fP use
7fe184
\fImongod \-\-repair\fP\&.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-oplog
7fe184
Ensures that \fBmongodump\fP creates a dump of
7fe184
the database that includes a partial \fIoplog\fP containing operations
7fe184
from the duration of the \fBmongodump\fP operation. This oplog
7fe184
produces an effective point\-in\-time snapshot of the state of a
7fe184
\fBmongod\fP instance. To restore to a specific point\-in\-time
7fe184
backup, use the output created with this option in conjunction with
7fe184
\fImongorestore \-\-oplogReplay\fP\&.
7fe184
.sp
7fe184
Without \fI\%\-\-oplog\fP, if there are write operations during the dump
7fe184
operation, the dump will not reflect a single moment in time. Changes
7fe184
made to the database during the update process can affect the output of
7fe184
the backup.
7fe184
.sp
7fe184
\fI\%\-\-oplog\fP has no effect when running \fBmongodump\fP
7fe184
against a \fBmongos\fP instance to dump the entire contents of a
7fe184
sharded cluster. However, you can use \fI\%\-\-oplog\fP to dump
7fe184
individual shards.
7fe184
.sp
7fe184
\fI\%\-\-oplog\fP only works against nodes that maintain an
7fe184
\fIoplog\fP\&. This includes all members of a replica set, as well as
7fe184
\fImaster\fP nodes in master/slave replication deployments.
7fe184
.sp
7fe184
\fI\%\-\-oplog\fP does not dump the oplog collection.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-dumpDbUsersAndRoles
7fe184
Includes user and role definitions when performing \fBmongodump\fP
7fe184
on a specific database. This option applies only when you specify a
7fe184
database in the \fI\-\-db\fP option. MongoDB always includes user and
7fe184
role definitions when \fBmongodump\fP applies to an entire instance
7fe184
and not just a specific database.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-excludeCollection array of strings
7fe184
New in version 3.0.0.
7fe184
7fe184
.sp
7fe184
Specifies collections to exclude from the output of \fBmongodump\fP output.
7fe184
.UNINDENT
7fe184
.INDENT 0.0
7fe184
.TP
7fe184
.B \-\-excludeCollectionsWithPrefix array of strings
7fe184
New in version 3.0.0.
7fe184
7fe184
.sp
7fe184
Excludes all collections from the output of \fBmongodump\fP with a specified prefix.
7fe184
.UNINDENT
7fe184
.SH USE
7fe184
.sp
7fe184
See the http://docs.mongodb.org/manual/tutorial/backup\-with\-mongodump
7fe184
for a larger overview of \fBmongodump\fP usage. Also see the
7fe184
\fBmongorestore\fP document for an overview of the
7fe184
\fBmongorestore\fP, which provides the related inverse
7fe184
functionality.
7fe184
.sp
7fe184
The following command creates a dump file that contains only the
7fe184
collection named \fBcollection\fP in the database named \fBtest\fP\&. In
7fe184
this case the database is running on the local interface on port
7fe184
\fB27017\fP:
7fe184
.INDENT 0.0
7fe184
.INDENT 3.5
7fe184
.sp
7fe184
.nf
7fe184
.ft C
7fe184
mongodump  \-\-db test \-\-collection collection
7fe184
.ft P
7fe184
.fi
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.sp
7fe184
In the next example, \fBmongodump\fP creates a database dump
7fe184
located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, from a database
7fe184
running on port \fB37017\fP on the host \fBmongodb1.example.net\fP and
7fe184
authenticating using the username \fBuser\fP and the password
7fe184
\fBpass\fP, as follows:
7fe184
.INDENT 0.0
7fe184
.INDENT 3.5
7fe184
.sp
7fe184
.nf
7fe184
.ft C
7fe184
mongodump \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass \-\-out /opt/backup/mongodump\-2011\-10\-24
7fe184
.ft P
7fe184
.fi
7fe184
.UNINDENT
7fe184
.UNINDENT
7fe184
.SH AUTHOR
7fe184
MongoDB Documentation Project
7fe184
.SH COPYRIGHT
7fe184
2011-2015
7fe184
.\" Generated by docutils manpage writer.
7fe184
.