Blame SOURCES/mongodump.1

334bcc
.\" Man page generated from reStructuredText.
334bcc
.
334bcc
.TH "MONGODUMP" "1" "January 30, 2015" "3.0" "mongodb-manual"
334bcc
.SH NAME
334bcc
mongodump \- MongoDB Data Dump Utility
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
\fBmongodump\fP is a utility for creating a binary export of the
334bcc
contents of a database. Consider using this utility as part of an
334bcc
effective \fBbackup strategy\fP\&. Use
334bcc
\fBmongodump\fP in conjunction with \fBmongorestore\fP to
334bcc
restore databases.
334bcc
.sp
334bcc
\fBmongodump\fP can read data from either \fBmongod\fP or \fBmongos\fP
334bcc
instances, in addition to reading directly from MongoDB data files
334bcc
without an active \fBmongod\fP\&.
334bcc
.sp
334bcc
\fBSEE ALSO:\fP
334bcc
.INDENT 0.0
334bcc
.INDENT 3.5
334bcc
\fBmongorestore\fP,
334bcc
http://docs.mongodb.org/manual/tutorial/backup\-sharded\-cluster\-with\-database\-dumps
334bcc
and http://docs.mongodb.org/manual/core/backups\&.
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.SH BEHAVIOR
334bcc
.sp
334bcc
\fBmongodump\fP does \fInot\fP dump the content of the \fBlocal\fP database.
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
When running \fBmongodump\fP against a \fBmongos\fP instance
334bcc
where the \fIsharded cluster\fP consists of \fIreplica sets\fP, the \fIread preference\fP of the operation will prefer reads
334bcc
from \fIsecondary\fP members of the set.
334bcc
.sp
334bcc
Changed in version 2.2: When used in combination with \fBfsync\fP or
334bcc
\fBdb.fsyncLock()\fP, \fBmongod\fP will block
334bcc
reads, including those from \fBmongodump\fP, when
334bcc
queued write operation waits behind the \fBfsync\fP
334bcc
lock. Do not use \fBmongodump\fP with
334bcc
\fBdb.fsyncLock()\fP\&.
334bcc
334bcc
.sp
334bcc
\fBmongodump\fP overwrites output files if they exist in the
334bcc
backup data folder. Before running the \fBmongodump\fP command
334bcc
multiple times, either ensure that you no longer need the files in the
334bcc
output folder (the default is the \fBdump/\fP folder) or rename the
334bcc
folders or files.
334bcc
.SH REQUIRED ACCESS
334bcc
.SS Backup Collections
334bcc
.sp
334bcc
To backup all the databases in a cluster via \fBmongodump\fP, you
334bcc
should have the \fBbackup\fP role. The \fBbackup\fP role provides
334bcc
the required privileges for backing up all databases. The role confers no
334bcc
additional access, in keeping with the policy of \fIleast privilege\fP\&.
334bcc
.sp
334bcc
To backup a given database, you must have \fBread\fP access on the database.
334bcc
Several roles provide this access, including the \fBbackup\fP role.
334bcc
.sp
334bcc
To backup the \fBsystem.profile\fP
334bcc
collection, which is created when you activate \fIdatabase profiling\fP, you must have \fBadditional\fP
334bcc
\fBread\fP access on this collection. Several
334bcc
roles provide this access, including the \fBclusterAdmin\fP and
334bcc
\fBdbAdmin\fP roles.
334bcc
.SS Backup Users
334bcc
.sp
334bcc
Changed in version 2.6.
334bcc
334bcc
.sp
334bcc
To backup users and \fIuser\-defined roles\fP for 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 backup a given database\(aqs users, you must have the
334bcc
\fBfind\fP \fIaction\fP on the \fBadmin\fP
334bcc
database\(aqs \fBadmin.system.users\fP collection. The \fBbackup\fP
334bcc
and \fBuserAdminAnyDatabase\fP roles both provide this privilege.
334bcc
.sp
334bcc
To backup the user\-defined roles on a database, you must have the
334bcc
\fBfind\fP action on the \fBadmin\fP database\(aqs
334bcc
\fBadmin.system.roles\fP collection. Both the \fBbackup\fP and
334bcc
\fBuserAdminAnyDatabase\fP roles provide this privilege.
334bcc
.SH OPTIONS
334bcc
.sp
334bcc
Changed in version 3.0.0: \fBmongodump\fP removed the \fB\-\-dbpath\fP as well as related
334bcc
\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. You must use
334bcc
\fBmongodump\fP while connected to a \fBmongod\fP instance.
334bcc
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B mongodump
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B mongodump
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-help
334bcc
Returns information on the options and use of \fBmongodump\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 \fBmongodump\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 \fBmongodump\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 \fBmongodump\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 \fBmongodump\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 \fBmongodump\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 \fBmongodump\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
\fBmongodump\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 \fBmongodump\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, \fBmongodump\fP will
334bcc
prompt interactively for a password on the console.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-authenticationDatabase <dbname>
334bcc
If you do not specify an authentication database, \fBmongodump\fP
334bcc
assumes that the database specified to export 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 \fBmongodump\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 to backup. If you do not specify a database,
334bcc
\fBmongodump\fP copies all databases in this instance into the dump
334bcc
files.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-collection <collection>, \-c <collection>
334bcc
Specifies a collection to backup. If you do not specify a collection,
334bcc
this option copies all collections in the specified database or instance
334bcc
to the dump files.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-query <json>, \-q <json>
334bcc
Provides a \fIJSON document\fP as a query that optionally limits the
334bcc
documents included in the output of \fBmongodump\fP\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-forceTableScan
334bcc
Forces \fBmongodump\fP to scan the data store directly: typically,
334bcc
\fBmongodump\fP saves entries as they appear in the index of
334bcc
the \fB_id\fP field. If you specify a query \fI\-\-query\fP,
334bcc
\fBmongodump\fP will use the most appropriate index to support that query.
334bcc
.sp
334bcc
Use \fI\-\-forceTableScan\fP to skip the index and scan the data directly. Typically
334bcc
there are two cases where this behavior is preferable to the
334bcc
default:
334bcc
.INDENT 7.0
334bcc
.IP 1. 3
334bcc
If you have key sizes over 800 bytes that would not be present in the
334bcc
\fB_id\fP index.
334bcc
.IP 2. 3
334bcc
Your database uses a custom \fB_id\fP field.
334bcc
.UNINDENT
334bcc
.sp
334bcc
When you run with \fI\-\-forceTableScan\fP, \fBmongodump\fP does
334bcc
not use \fB$snapshot\fP\&. As a result, the dump produced by
334bcc
\fBmongodump\fP can reflect the state of the database at many
334bcc
different points in time.
334bcc
.sp
334bcc
\fBIMPORTANT:\fP
334bcc
.INDENT 7.0
334bcc
.INDENT 3.5
334bcc
Use \fI\-\-forceTableScan\fP with extreme caution and
334bcc
consideration.
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-out <path>, \-o <path>
334bcc
Specifies the directory where \fBmongodump\fP will write
334bcc
\fIBSON\fP files for the dumped databases. By default,
334bcc
\fBmongodump\fP saves output files in a directory named
334bcc
\fBdump\fP in the current working directory.
334bcc
.sp
334bcc
To send the database dump to standard output, specify "\fB\-\fP" instead of
334bcc
a path. Write to standard output if you want process the output before
334bcc
saving it, such as to use \fBgzip\fP to compress the dump. When writing
334bcc
standard output, \fBmongodump\fP does not write the metadata that
334bcc
writes in a \fB<dbname>.metadata.json\fP file when writing to files
334bcc
directly.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-repair
334bcc
Runs a repair option in addition to dumping the
334bcc
database. The repair option changes the behavior of \fBmongodump\fP to
334bcc
only write valid data and exclude data that may be in
334bcc
an invalid state as a result of an improper shutdown or
334bcc
\fBmongod\fP crash.
334bcc
.sp
334bcc
The \fI\%\-\-repair\fP option uses aggressive data\-recovery algorithms
334bcc
that may produce a large amount of duplication.
334bcc
.sp
334bcc
\fI\%\-\-repair\fP is only available for use with \fBmongod\fP
334bcc
instances using the \fBmmapv1\fP storage engine. You cannot run
334bcc
\fI\%\-\-repair\fP with \fBmongos\fP or with \fBmongod\fP instances
334bcc
that use the \fBwiredTiger\fP storage engine. To repair data in a
334bcc
\fBmongod\fP instance using \fBwiredTiger\fP use
334bcc
\fImongod \-\-repair\fP\&.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-oplog
334bcc
Ensures that \fBmongodump\fP creates a dump of
334bcc
the database that includes a partial \fIoplog\fP containing operations
334bcc
from the duration of the \fBmongodump\fP operation. This oplog
334bcc
produces an effective point\-in\-time snapshot of the state of a
334bcc
\fBmongod\fP instance. To restore to a specific point\-in\-time
334bcc
backup, use the output created with this option in conjunction with
334bcc
\fImongorestore \-\-oplogReplay\fP\&.
334bcc
.sp
334bcc
Without \fI\%\-\-oplog\fP, if there are write operations during the dump
334bcc
operation, the dump will not reflect a single moment in time. Changes
334bcc
made to the database during the update process can affect the output of
334bcc
the backup.
334bcc
.sp
334bcc
\fI\%\-\-oplog\fP has no effect when running \fBmongodump\fP
334bcc
against a \fBmongos\fP instance to dump the entire contents of a
334bcc
sharded cluster. However, you can use \fI\%\-\-oplog\fP to dump
334bcc
individual shards.
334bcc
.sp
334bcc
\fI\%\-\-oplog\fP only works against nodes that maintain an
334bcc
\fIoplog\fP\&. This includes all members of a replica set, as well as
334bcc
\fImaster\fP nodes in master/slave replication deployments.
334bcc
.sp
334bcc
\fI\%\-\-oplog\fP does not dump the oplog collection.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-dumpDbUsersAndRoles
334bcc
Includes user and role definitions when performing \fBmongodump\fP
334bcc
on a specific database. This option applies only when you specify a
334bcc
database in the \fI\-\-db\fP option. MongoDB always includes user and
334bcc
role definitions when \fBmongodump\fP applies to an entire instance
334bcc
and not just a specific database.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-excludeCollection array of strings
334bcc
New in version 3.0.0.
334bcc
334bcc
.sp
334bcc
Specifies collections to exclude from the output of \fBmongodump\fP output.
334bcc
.UNINDENT
334bcc
.INDENT 0.0
334bcc
.TP
334bcc
.B \-\-excludeCollectionsWithPrefix array of strings
334bcc
New in version 3.0.0.
334bcc
334bcc
.sp
334bcc
Excludes all collections from the output of \fBmongodump\fP with a specified prefix.
334bcc
.UNINDENT
334bcc
.SH USE
334bcc
.sp
334bcc
See the http://docs.mongodb.org/manual/tutorial/backup\-with\-mongodump
334bcc
for a larger overview of \fBmongodump\fP usage. Also see the
334bcc
\fBmongorestore\fP document for an overview of the
334bcc
\fBmongorestore\fP, which provides the related inverse
334bcc
functionality.
334bcc
.sp
334bcc
The following command creates a dump file that contains only the
334bcc
collection named \fBcollection\fP in the database named \fBtest\fP\&. In
334bcc
this case the database is running on the local interface on port
334bcc
\fB27017\fP:
334bcc
.INDENT 0.0
334bcc
.INDENT 3.5
334bcc
.sp
334bcc
.nf
334bcc
.ft C
334bcc
mongodump  \-\-db test \-\-collection collection
334bcc
.ft P
334bcc
.fi
334bcc
.UNINDENT
334bcc
.UNINDENT
334bcc
.sp
334bcc
In the next example, \fBmongodump\fP creates a database dump
334bcc
located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, from a database
334bcc
running on port \fB37017\fP on the host \fBmongodb1.example.net\fP and
334bcc
authenticating using the username \fBuser\fP and the password
334bcc
\fBpass\fP, as follows:
334bcc
.INDENT 0.0
334bcc
.INDENT 3.5
334bcc
.sp
334bcc
.nf
334bcc
.ft C
334bcc
mongodump \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass \-\-out /opt/backup/mongodump\-2011\-10\-24
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
.