Docs Menu

Docs HomeLaunch & Manage MongoDBAtlas CLI

atlas clusters onlineArchives create

On this page

  • Syntax
  • Options
  • Inherited Options
  • Examples

Create an online archive for a collection in the specified cluster.

You can create an online archive for an M10 or larger cluster.

To learn more about online archives, see https://www.mongodb.com/docs/atlas/online-archive/manage-online-archive/.

To use this command, you must authenticate with a user account or an API key with the Project Data Access Admin role.

Command Syntax
atlas clusters onlineArchives create [options]
Name
Type
Required
Description
--archiveAfter
int
false

Number of days after which to archive cluster data.

Mutually exclusive with --file.

--clusterName
string
true
Name of the cluster.
--collection
string
false

Name of the collection.

Mutually exclusive with --file.

--dateField
string
false

Name of an already indexed date field from the documents.

Mutually exclusive with --file.

--dateFormat
string
false

Date format for the date field. Valid values are "ISODATE", "EPOCH_SECONDS", "EPOCH_MILLIS", or "EPOCH_NANOSECONDS".

Mutually exclusive with --file. This value defaults to "ISODATE".

--db
string
false

Name of the database.

Mutually exclusive with --file.

--expireAfterDays
int
false

Number of days used in the date criteria for nominating documents for deletion.

Mutually exclusive with --file.

--file
string
false

Path to an optional JSON configuration file that defines online archive settings. To learn more about online archive configuration files for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-json-online-archive-config.

Mutually exclusive with --db, --collection, --dateField, --dateFormat, --archiveAfter, --expireAfterDays, --partition.

-h, --help
false
help for create
-o, --output
string
false
Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option.
--partition
strings
false

Fields to use to partition data. You can specify up to two frequently queried fields separated by a comma.

Mutually exclusive with --file.

--projectId
string
false
Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
Name
Type
Required
Description
-P, --profile
string
false
Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
# Create an online archive for the sample_mflix.movies collection in a cluster named myTestCluster when the current date is greater than the value of released date plus 2 days:
atlas clusters onlineArchive create --clusterName myTestCluster --db sample_mflix --collection movies --dateField released --archiveAfter 2 --output json
# Create an online archive for the sample_mflix.movies collection in a cluster named myTestCluster using a profile named egAtlasProfile when the current date is greater than the value of the released date plus 2 days. Data is partitioned based on the title field, year field, and released field from the documents in the collection:
atlas clusters onlineArchive create --clusterName myTestCluster --db sample_mflix --collection movies --dateField released --archiveAfter 2 --partition title,year --output json -P egAtlasProfile
← atlas clusters onlineArchives