Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCSP-39421-detailed-extras #151

Merged
60 changes: 60 additions & 0 deletions source/mongodump.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,66 @@ Run ``mongodump`` from the system command line, not the

.. include:: /includes/fact-online-archive-callout.rst

``mongodump`` dumps:

- Collection documents, metadata, and options.
- Index definitions.
- Writes that occur during the export, if run with the ``mongodump``
:option:`--oplog <mongodump --oplog>` option.

``mongodump`` dumps data to a directory or a binary archive file.

Dump Data to a Directory
~~~~~~~~~~~~~~~~~~~~~~~~

Example ``mongodump`` directory dump structure and files:

.. code-block:: none

dump
├── easternSalesDatabase
│ ├── sales.bson
│ ├── sales.metadata.json
│ └── salesByMonthView.metadata.json
├── westernSalesDatabase
│ ├── sales.bson
│ ├── sales.metadata.json
│ └── salesByMonthView.metadata.json
└── oplog.bson

For a directory dump, ``mongodump`` creates:

- A root directory with the default name ``dump``. You can set the name
with the ``mongodump`` :option:`--out <mongodump --out>` option.
- A subdirectory in the root directory for each database. For example,
if a database name is ``easternSalesDatabase``, the subdirectory name
is also ``easternSalesDatabase``.
- A BSON file with documents for each collection. For example, if a
collection name is ``sales``, the BSON file is ``sales.bson``.
- A metadata JSON file for each collection in each database directory.
For example, a metadata ``sales.metadata.json`` file. The file
contains a document with the exported collection metadata, options,
and indexes.
- A metadata JSON file for each view. For example, a metadata
``salesByMonthView.metadata.json`` file. A view doesn't have a BSON
file.
- An optional :term:`oplog` ``oplog.bson`` file, located in the root
directory, which contains write operations that occurred during the
``mongodump`` run. To output an ``oplog.bson`` file, use the
``mongodump`` :option:`--oplog <mongodump --oplog>` option.

If you use the ``mongodump`` :option:`--gzip <mongodump --gzip>` option,
the BSON files and JSON metadata files are compressed. The compressed
exported files have ``bson.gz`` and ``metadata.json.gz`` at the end of
the names.

Dump Data to a Binary Archive File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To dump data to a binary archive file, use the ``mongodump``
:option:`--archive <mongodump --archive>` option. ``mongodump`` creates
a binary file that contains the archived data.

Syntax
------

Expand Down