Skip to content

Commit 3ad11c4

Browse files
DOCSP-11184 doc for online archive create command (#151)
* DOCSP-11184 doc for online archive
1 parent a72a8cf commit 3ad11c4

File tree

5 files changed

+306
-0
lines changed

5 files changed

+306
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.. list-table::
2+
:header-rows: 1
3+
:widths: 20 10 60
4+
5+
* - Field
6+
- Type
7+
- Description
8+
9+
* - ``clusterName``
10+
- string
11+
- Name of the cluster that contains the collection.
12+
13+
* - ``collName``
14+
- string
15+
- Name of the collection.
16+
17+
* - ``criteria``
18+
- document
19+
- Criteria to use for archiving data.
20+
21+
* - ``criteria.dateField``
22+
- string
23+
- Name of the date field that the online archive is based on. Data is
24+
archived when the current date is greater than the value of the date
25+
field plus the number of days specified via the ``archiveAfter`` option.
26+
27+
* - ``criteria.expireAfterDays``
28+
- int
29+
- Number of days after which to archive data as specified using the
30+
``archiveAfter`` option. Data is archived when the current date is
31+
greater than the value of the date field specified via the ``dateField``
32+
option plus the number of days specified here.
33+
34+
* - ``dbName``
35+
- string
36+
- Name of the database that contains the collection.
37+
38+
* - ``groupId``
39+
- string
40+
- Unique identifier of the project that contains the cluster.
41+
42+
* - ``partitionFields``
43+
- array of documents
44+
- Fields to use to partition data.
45+
46+
* - ``partitionFields.fieldName``
47+
- string
48+
- Name of the field.
49+
50+
* - ``partitionFields.fieldType``
51+
- string
52+
- Data type of the field.
53+
54+
* - ``partitionFields.order``
55+
- int
56+
- Position of the field in the partition. Value can be:
57+
58+
- ``0`` - for the first position
59+
- ``1`` - for the second position
60+
- ``2`` - for the third position
61+
62+
* - ``paused``
63+
- boolean
64+
- Whether or not the online archive is paused. Value is:
65+
66+
- ``true`` if the online archive is in paused state.
67+
- ``false`` if the online archive is in pending or active state.
68+
69+
* - ``state``
70+
- string
71+
- State of the online archive. Value can be:
72+
73+
- ``PENDING`` - Indicates archiving has not yet started. In this state,
74+
documents queued for archiving are still on your active |service|
75+
cluster, but cannot be modified.
76+
- ``ACTIVE`` - Indicates archiving has started. In this state, the
77+
documents that meet the criteria for archiving are archived or are being archived.
78+
- ``PAUSED`` - Indicates archiving has been temporarily stopped. In this
79+
state, previously archived documents continue to be available on S3, but archiving operation on active cluster is on hold. You can resume archiving for paused archives at any time.
80+
- ``DELETED`` - Indicates online archive was deleted. When you delete an
81+
online archive, associated archived documents are removed from the S3 buckets.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. admonition:: Beta
2+
:class: note
3+
4+
Online archive is available as a Beta feature. The feature and the
5+
corresponding documentation may change at any time during the Beta
6+
stage.

source/reference/atlas.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Atlas ``mongocli`` Commands
3131
:ref:`metric <mcli-reference-atlas-metric>`
3232
List metrics for MongoDB processes on a specified host.
3333

34+
:ref:`online archive <mcli-reference-atlas-onlinearchive>`
35+
Manage :atlas:`online archives </online-archive/manage-online-archive/>`
36+
for a cluster.
37+
3438
:ref:`process <mcli-reference-atlas-process>`
3539
Retrieve information about MongoDB processes running on a specified
3640
|service| project.
@@ -50,6 +54,7 @@ Atlas ``mongocli`` Commands
5054
Events </reference/atlas/event-commands>
5155
Logs </reference/atlas/log-commands>
5256
Metrics </reference/atlas/metric-commands>
57+
Online Archives </reference/atlas/onlinearchive-commands>
5358
Processes </reference/atlas/process-commands>
5459
Whitelists </reference/atlas/whitelist-commands>
5560
Data Lakes </reference/atlas/datalake-commands>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. _mcli-reference-atlas-onlinearchive:
2+
3+
=============================
4+
Atlas Online Archive Commands
5+
=============================
6+
7+
.. default-domain:: mongodb
8+
9+
.. include:: /includes/fact-online-archive-beta.rst
10+
11+
12+
.. toctree::
13+
:titlesonly:
14+
15+
Create an Online Archive </reference/atlas/onlinearchive-create>
16+
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
.. _mcli-atlas-onlinearchive-create-command:
2+
3+
===================================
4+
mongocli atlas onlinearchive create
5+
===================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
.. include:: /includes/fact-online-archive-beta.rst
16+
17+
The ``onlinearchive create`` command creates an :atlas:`online archive
18+
</online-archive/manage-online-archive/>` for the specified collection in the ``M10`` or higher cluster. You can also create an online archive through the
19+
|service| :atlas:`UI </online-archive/configure-online-archive/>` or :atlas:`API </reference/api/online-archive-create-one/>`.
20+
21+
.. _mcli-atlas-online-archive-create-syntax:
22+
23+
Syntax
24+
------
25+
26+
.. code-block:: text
27+
28+
mongocli atlas onlinearchive create
29+
--archiveAfter <number-of-days>
30+
--clusterName <cluster-name>
31+
--collection <collection-name>
32+
--dateField <date-field-name>
33+
--db <database-name>
34+
--partition <partition-field-names>
35+
[ --profile|-P <profile-name> ]
36+
[ --projectId <project-ID> ]
37+
38+
.. _mcli-atlas-onlinearchive-create-options:
39+
40+
Options
41+
-------
42+
43+
.. list-table::
44+
:header-rows: 1
45+
:widths: 20 10 60 10
46+
47+
* - Option
48+
- Type
49+
- Description
50+
- Required?
51+
52+
* - ``archiveAfter``
53+
- int
54+
- Number of days after which to archive cluster data.
55+
- yes
56+
57+
* - ``clusterName``
58+
- string
59+
- Name of the cluster.
60+
- yes
61+
62+
* - ``collection``
63+
- string
64+
- Name of the collection for which to create an online archive.
65+
- yes
66+
67+
* - ``dateField``
68+
- string
69+
- Name of an already indexed date field from the documents.
70+
- yes
71+
72+
* - ``db``
73+
- string
74+
- Name of the database that contains the collection.
75+
- yes
76+
77+
* - ``partition``
78+
- string
79+
- Name of the fields to use to partition data. You can specify up to two
80+
frequently queried fields, separated by a comma, in the following format: ``<field-name>:<data-type>``. The order in which the fields are specified defines the position of the field in the partition. That is:
81+
82+
- The first field has the first position (``0``) in the partition.
83+
- The second field has the second position (``1``) in the partition.
84+
85+
The data type must match the data type of the field in the documents.
86+
- no
87+
88+
* - ``--profile``, ``-P``
89+
- string
90+
- Name of the profile where the public and private
91+
keys for the project are saved. If omitted, uses the
92+
{+default-profile+}. To learn more about creating a
93+
profile, see :ref:`mcli-configure`.
94+
- no
95+
96+
* - ``--projectId``
97+
- string
98+
- Unique identifier of the project that contains the
99+
cluster. If omitted, uses the project ID in the profile or
100+
:ref:`environment variable <mcli-env-var>`.
101+
- no
102+
103+
.. _mcli-atlas-onlinearchive-create-output:
104+
105+
Output
106+
------
107+
108+
.. include:: /includes/command-output-intro.rst
109+
110+
.. include:: /includes/atlas-online-archive-output.rst
111+
112+
.. _mcli-atlas-onlinearchive-create-egs:
113+
114+
Examples
115+
--------
116+
117+
The following examples show two ways to create an online archive using the ``mongocli atlas onlinearchive create`` command. The **Basic Example** shows how to create an online archive without additional partition fields and the **Partitions Example** shows how to create an online archive with partitions.
118+
119+
.. tabs::
120+
121+
.. tab:: Basic Example
122+
:tabid: basic
123+
124+
The following ``mongocli atlas onlinearchive create`` command creates an online archive for the ``sample_mflix.movies`` collection in a cluster named ``myTestCluster`` using the default profile. The criteria for archiving data indicates that data should be archived when the current date is greater than the value of the ``dateField`` option plus the number of days specified through the ``archiveAfter`` option.
125+
126+
.. code-block:: shell
127+
128+
mongocli atlas cluster onlineArchive create --clusterName myTestCluster --db sample_mflix --collection movies --dateField released --archiveAfter 2
129+
130+
The previous command prints the following fields in |json| format to the
131+
terminal. To learn more about these fields, see
132+
:ref:`mcli-atlas-onlinearchive-create-output`.
133+
134+
.. code-block:: sh
135+
:copyable: false
136+
137+
{
138+
"_id": "5f1726ca460fd352106557c2",
139+
"clusterName": "myTestCluster",
140+
"collName": "movies",
141+
"criteria": {
142+
"dateField": "released",
143+
"expireAfterDays": 2
144+
},
145+
"dbName": "sample_mflix",
146+
"groupId": "5e2211c17a3e5a48f5497de3",
147+
"paused": false,
148+
"state": "PENDING"
149+
}
150+
151+
.. tab:: Partitions Example
152+
:tabid: partitions
153+
154+
The following ``mongocli atlas onlinearchive create`` command creates an online archive for the ``sample_mflix.movies`` collection in a cluster named ``myTestCluster`` using a profile named ``egAtlasProfile``. Data is partitioned based on the ``title`` field, ``year`` field, and ``released`` field from the documents in the collection. The criteria for archiving data indicates that data should be archived when the current
155+
date is greater than the value of the ``dateField`` option plus the
156+
number of days specified through the ``archiveAfter`` option.
157+
158+
.. code-block:: shell
159+
160+
mongocli atlas cluster onlineArchive create --clusterName myTestCluster --db sample_mflix --collection movies --dateField released --archiveAfter 2 --partition title:string,year:int -P egAtlasProfile
161+
162+
The previous command prints the following fields in |json| format to the
163+
terminal. To learn more about these fields, see
164+
:ref:`mcli-atlas-onlinearchive-create-output`.
165+
166+
.. code-block:: sh
167+
:copyable: false
168+
169+
{
170+
"_id": "5f173012a22aa23d58a8b2f0",
171+
"clusterName": "myTestCluster",
172+
"collName": "movies",
173+
"criteria": {
174+
"dateField": "released",
175+
"expireAfterDays": 2
176+
},
177+
"dbName": "sample_mflix",
178+
"groupId": "5e2211c17a3e5a48f5497de3",
179+
"partitionFields": [
180+
{
181+
"fieldName": "title",
182+
"fieldType": "string",
183+
"order": 0
184+
},
185+
{
186+
"fieldName": "year",
187+
"fieldType": "number",
188+
"order": 1
189+
},
190+
{
191+
"fieldName": "released",
192+
"fieldType": "date",
193+
"order": 2
194+
}
195+
],
196+
"paused": false,
197+
"state": "PENDING"
198+
}

0 commit comments

Comments
 (0)