Navigation

mongocli atlas cluster onlinearchive update

On this page

Beta

Online archive is available as a Beta feature. The feature and the corresponding documentation may change at any time during the Beta stage.

The onlinearchive update command modifies the archiving rule in the specified online archive for the specified cluster. You can also modify the archiving rule through the Atlas UI or API.

Syntax

mongocli atlas cluster onlinearchive update <online-archive-id>
     --archiveAfter <number-of-days>
     --clusterName <cluster-name>
     [ --output|-o <output-format> ]
     [ --profile|-P <profile-name> ]
     [ --projectId <project-ID> ]

Options

Option Type Description Required?
<online-archive-id> string Unique identifier of the online archive to update. yes
--archiveAfter int Number of days after which to archive cluster data. yes
--clusterName string Name of the cluster. yes
--output, -o string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using Go template file

If omitted, the command returns output in the default format.

no
--profile, -P string Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI. no
--projectId string Unique identifier of the project that contains the cluster. If omitted, uses the project ID in the profile or environment variable. no

Output

The command prints the following fields in the specified format to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.

Field Type Description
clusterName string Name of the cluster that contains the collection.
collName string Name of the collection.
criteria document Criteria to use for archiving data.
criteria.dateField string Name of the date field that the online archive is based on. Data is archived when the current date is greater than the value of the date field plus the number of days specified via the archiveAfter option.
criteria.expireAfterDays int Number of days after which to archive data as specified using the archiveAfter option. Data is archived when the current date is greater than the value of the date field specified via the dateField option plus the number of days specified here.
dbName string Name of the database that contains the collection.
groupId string Unique identifier of the project that contains the cluster.
partitionFields array of documents Fields to use to partition data.
partitionFields.fieldName string Name of the field.
partitionFields.fieldType string Data type of the field.
partitionFields.order int

Position of the field in the partition. Value can be:

  • 0 - for the first position
  • 1 - for the second position
  • 2 - for the third position
paused boolean

Whether or not the online archive is paused. Value is:

  • true if the online archive is in paused state.
  • false if the online archive is in pending or active state.
state string

State of the online archive. Value can be:

  • PENDING - Indicates archiving has not yet started. In this state, documents queued for archiving are still on your active Atlas cluster, but cannot be modified.
  • ACTIVE - Indicates archiving has started. In this state, the documents that meet the criteria for archiving are archived or are being archived.
  • PAUSED - Indicates archiving has been temporarily stopped. In this 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.
  • DELETED - Indicates online archive was deleted. When you delete an online archive, associated archived documents are removed from the S3 buckets.

Examples

The following example uses the mongocli atlas cluster onlinearchive update command to modify the archiving rule in the specified online archive for the cluster named myTestCluster. It uses the default profile to access the project.

mongocli atlas cluster onlinearchive update 5f189832e26ec075e10c32d3 --clusterName myTestCluster --archiveAfter 5 --output json

The previous command prints the following fields in the specified format to the terminal. To learn more about these fields, see Output.

{
      "_id": "5f189832e26ec075e10c32d3",
      "clusterName": "myTestCluster",
      "collName": "movies",
      "criteria": {
             "dateField": "released",
             "expireAfterDays": 5
      },
      "dbName": "sample_mflix",
      "groupId": "5e2211c17a3e5a48f5497de3",
      "partitionFields": [
             {
                     "fieldName": "title",
                     "fieldType": "string",
                     "order": 0
             },
             {
                     "fieldName": "year",
                     "fieldType": "int",
                     "order": 1
             },
             {
                     "fieldName": "released",
                     "fieldType": "date",
                     "order": 2
             }
      ],
      "paused": true,
      "state": "PAUSED"
}