Docs Menu
Docs Home
/ /
MongoDB Command Line Interface
/ / /

mongocli atlas backup snapshots list

On this page

  • Syntax
  • Options
  • Output
  • Example

The backup snapshots list command retrieves the list of snapshots for the specified cluster. You can also view the list of snapshots through the Atlas UI or API.

mongocli atlas backup snapshots list|ls <cluster-name>
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
[ --projectId <project-ID> ]

Note

Use -h or --help to view the command-line help for this command.

Option
Type
Description
Required?
<cluster-name>
string
The 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 project ID and the Programmatic API 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. If omitted, uses the project ID in the profile or environment variable.

no

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

Field
Type
Description
clusterId
string
The unique ID of the cluster that the snapshot represents.
complete
boolean
Indicates whether the snapshot exists. Returns false if the snapshot creation job is in progress.
created
Document
The BSON timestamp information for the point in time when the snapshot was created.
created.date
timestamp
created.increment
integer
The operation order in which this snapshot took place at this exact point in time. To learn how timestamps work in MongoDB, see timestamp.
doNotDelete
boolean
Specifies whether the snapshot can be deleted.
expires
timestamp

The date in ISO 8601 date and time format in UTC after which Atlas deletes the snapshot.

If doNotDelete is set to true, any value in expires is removed.

If the expires value is earlier than the current date and time, the snaphot cannot be edited.

groupId
objectId
ID of the project that owns the snapshot.
id
objectId
ID of the snapshot.
lastOplogAppliedTimestamp
document
The components of the timestamp of the last oplog entry was applied.
lastOplogAppliedTimestamp.date
timestamp
The exact point in time when the last oplog was applied in ISO 8601 date and time format in UTC.
lastOplogAppliedTimestamp.increment
integer
The operation order in which the last oplog was applied at this exact point in time. To learn how timestamps work in MongoDB, see timestamp.
links
document array
One or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
parts
document array

The individual parts that comprise the complete snapshot.

  • For a replica set, this array contains a single document.

  • For a sharded cluster, this array contains one document for each shard plus one document for the config server.

parts.clusterId
objectId
ID of the replica set.
parts.compressionSetting
string
Method of compression for the snapshot.
parts.dataSizeBytes
number
The total size of the data in the snapshot in bytes.
parts.encryptionEnabled
boolean
Indicates whether the snapshot is encrypted.
parts.fileSizeBytes
number
The total size of the data files in bytes.
parts.masterKeyUUID
objectId

The KMIP master key ID used to encrypt the snapshot data.

Note

This appears only if parts.encryptionEnabled is true.

parts.mongodVersion
string
The version of MongoDB that the replica set primary was running when the snapshot was created.
parts.replicaSetName
string
Name of the replica set.
parts.shardName
string
Name of the shard.
parts.storageSizeBytes
number
The total size of space allocated for document storage.
parts.typeName
string

The type of server that the part represents:

  • REPLICA_SET

  • CONFIG_SERVER_REPLICA_SET

The following example uses the mongocli atlas backup snapshots list command to retrieve the list of snapshots for the cluster named myDemo. The command uses the default profile, where the project ID and the Programmatic API Keys are stored.

mongocli atlas backups snapshots list myDemo --output json

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

{
"results": [
{
"clusterId": "5e7c9d670d3dc6709ea6cab6",
"complete": true,
"created": {
"date": "2020-03-26T12:21:05Z",
"increment": 1
},
"doNotDelete": false,
"expires": "2021-03-25T12:21:05Z",
"groupId": "5e2211c17a3e5a48f5497de3",
"id": "5e7c9e7f3a4a8e771136762a",
"lastOplogAppliedTimestamp": {
"date": "2020-03-26T12:21:04Z",
"increment": 1
},
"links": [
{
"rel": "self",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5e2211c17a3e5a48f5497de3/clusters/myDemo/snapshots/5e7c9e7f3a4a8e771136762a"
}
],
"parts": [
{
"replicaSetName": "myDemo-shard-0",
"typeName": "REPLICA_SET",
"clusterId": "5e7c9d670d3dc6709ea6cab6",
"compressionSetting": "GZIP",
"dataSizeBytes": 8032,
"encryptionEnabled": false,
"fileSizeBytes": 271599,
"mongodVersion": "4.0.17",
"storageSizeBytes": 57344,
"shardName": "",
"tokenDiscovered": false,
"tokenTimestamp": {
"date": "",
"increment": 0
}
}
]
}
],
"links": [
{
"rel": "self",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5e2211c17a3e5a48f5497de3/clusters/myDemo/snapshots?pageNum=1\u0026itemsPerPage=100"
}
],
"totalCount": 1
}

Back

Start a Backup Restore