@@ -60,6 +60,66 @@ Run ``mongodump`` from the system command line, not the
60
60
61
61
.. include:: /includes/fact-online-archive-callout.rst
62
62
63
+ ``mongodump`` dumps:
64
+
65
+ - Collection documents, metadata, and options.
66
+ - Index definitions.
67
+ - Writes that occur during the export, if run with the ``mongodump``
68
+ :option:`--oplog <mongodump --oplog>` option.
69
+
70
+ ``mongodump`` dumps data to a directory or a binary archive file.
71
+
72
+ Dump Data to a Directory
73
+ ~~~~~~~~~~~~~~~~~~~~~~~~
74
+
75
+ Example ``mongodump`` directory dump structure and files:
76
+
77
+ .. code-block:: none
78
+
79
+ dump
80
+ ├── easternSalesDatabase
81
+ │ ├── sales.bson
82
+ │ ├── sales.metadata.json
83
+ │ └── salesByMonthView.metadata.json
84
+ ├── westernSalesDatabase
85
+ │ ├── sales.bson
86
+ │ ├── sales.metadata.json
87
+ │ └── salesByMonthView.metadata.json
88
+ └── oplog.bson
89
+
90
+ For a directory dump, ``mongodump`` creates:
91
+
92
+ - A root directory with the default name ``dump``. You can set the name
93
+ with the ``mongodump`` :option:`--out <mongodump --out>` option.
94
+ - A subdirectory in the root directory for each database. For example,
95
+ if a database name is ``easternSalesDatabase``, the subdirectory name
96
+ is also ``easternSalesDatabase``.
97
+ - A BSON file with documents for each collection. For example, if a
98
+ collection name is ``sales``, the BSON file is ``sales.bson``.
99
+ - A metadata JSON file for each collection in each database directory.
100
+ For example, a metadata ``sales.metadata.json`` file. The file
101
+ contains a document with the exported collection metadata, options,
102
+ and indexes.
103
+ - A metadata JSON file for each view. For example, a metadata
104
+ ``salesByMonthView.metadata.json`` file. A view doesn't have a BSON
105
+ file.
106
+ - An optional :term:`oplog` ``oplog.bson`` file, located in the root
107
+ directory, which contains write operations that occurred during the
108
+ ``mongodump`` run. To output an ``oplog.bson`` file, use the
109
+ ``mongodump`` :option:`--oplog <mongodump --oplog>` option.
110
+
111
+ If you use the ``mongodump`` :option:`--gzip <mongodump --gzip>` option,
112
+ the BSON files and JSON metadata files are compressed. The compressed
113
+ exported files have ``bson.gz`` and ``metadata.json.gz`` at the end of
114
+ the names.
115
+
116
+ Dump Data to a Binary Archive File
117
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118
+
119
+ To dump data to a binary archive file, use the ``mongodump``
120
+ :option:`--archive <mongodump --archive>` option. ``mongodump`` creates
121
+ a binary file that contains the archived data.
122
+
63
123
Syntax
64
124
------
65
125
0 commit comments