1. Registry
  2. Packages
  3. Mongodbatlas Provider
  4. API Docs
  5. getCloudBackupCollectionRestoreJobCollection
Viewing docs for MongoDB Atlas v4.15.0
published on Friday, Aug 28, 2026 by Pulumi
mongodbatlas logo mongodbatlas logo
Viewing docs for MongoDB Atlas v4.15.0
published on Friday, Aug 28, 2026 by Pulumi

    mongodbatlas.getCloudBackupCollectionRestoreJobCollection describes the restore state of one collection in a collection restore job.

    To use this data source, the requesting Service Account or API Key must have the Backup Manager or Project Owner role.

    Note: This data source returns no collection state while the job is INITIALIZING. Collection states exist after the job enters IN_PROGRESS.

    Example Usage

    The following example lists per-collection restore state for a job, then reads one collection by sourceNamespace. When sourceNamespace is omitted, the example defaults to the last namespace from the plural data source.

    import * as pulumi from "@pulumi/pulumi";
    import * as mongodbatlas from "@pulumi/mongodbatlas";
    import * as std from "@pulumi/std";
    
    // Per-collection read-back for the resolved collection restore job.
    const _this = mongodbatlas.getCloudBackupCollectionRestoreJobCollections({
        projectId: projectId,
        clusterName: clusterName,
        jobId: jobId,
    });
    const collections = std.coalesce({
        input: [
            _this.then(_this => _this.results),
            [],
        ],
    }).result;
    const sourceNamespace = std.coalesce({
        input: [
            sourceNamespaceConfig,
            collections.length > 0 ? collections[collections.length - 1].sourceNamespace : null,
        ],
    }).result;
    export const collectionStates = .map(c => ({
        sourceNamespace: c.sourceNamespace,
        targetNamespace: c.targetNamespace,
        effectiveTargetNamespace: c.effectiveTargetNamespace,
        state: c.state,
        indexStatus: c.indexStatus,
        documents: `${c.restoredDocuments} / ${c.totalDocuments}`,
    }));
    const thisGetCloudBackupCollectionRestoreJobCollection = mongodbatlas.getCloudBackupCollectionRestoreJobCollection({
        projectId: projectId,
        clusterName: clusterName,
        jobId: jobId,
        sourceNamespace: sourceNamespace,
    });
    export const collectionState = thisGetCloudBackupCollectionRestoreJobCollection.then(thisGetCloudBackupCollectionRestoreJobCollection => thisGetCloudBackupCollectionRestoreJobCollection.state);
    
    import pulumi
    import pulumi_mongodbatlas as mongodbatlas
    import pulumi_std as std
    
    # Per-collection read-back for the resolved collection restore job.
    this = mongodbatlas.get_cloud_backup_collection_restore_job_collections(project_id=project_id,
        cluster_name=cluster_name,
        job_id=job_id)
    collections = std.coalesce(input=[
        this.results,
        [],
    ])["result"]
    source_namespace = std.coalesce(input=[
        source_namespace_config,
        collections[len(collections) - 1]["sourceNamespace"] if len(collections) > 0 else None,
    ])["result"]
    pulumi.export("collectionStates", [{
        "sourceNamespace": c["sourceNamespace"],
        "targetNamespace": c["targetNamespace"],
        "effectiveTargetNamespace": c["effectiveTargetNamespace"],
        "state": c["state"],
        "indexStatus": c["indexStatus"],
        "documents": f"{c['restoredDocuments']} / {c['totalDocuments']}",
    } for c in collections])
    this_get_cloud_backup_collection_restore_job_collection = mongodbatlas.get_cloud_backup_collection_restore_job_collection(project_id=project_id,
        cluster_name=cluster_name,
        job_id=job_id,
        source_namespace=source_namespace)
    pulumi.export("collectionState", this_get_cloud_backup_collection_restore_job_collection.state)
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mongodbatlas = Pulumi.Mongodbatlas;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        // Per-collection read-back for the resolved collection restore job.
        var @this = Mongodbatlas.GetCloudBackupCollectionRestoreJobCollections.Invoke(new()
        {
            ProjectId = projectId,
            ClusterName = clusterName,
            JobId = jobId,
        });
    
        var collections = Std.Coalesce.Invoke(new()
        {
            Input = new[]
            {
                @this.Apply(@this => @this.Apply(getCloudBackupCollectionRestoreJobCollectionsResult => getCloudBackupCollectionRestoreJobCollectionsResult.Results)),
                new[] {},
            },
        }).Result;
    
        var sourceNamespace = Std.Coalesce.Invoke(new()
        {
            Input = new[]
            {
                sourceNamespaceConfig,
                collections.Length > 0 ? collections[collections.Length - 1].SourceNamespace : null,
            },
        }).Result;
    
        var thisGetCloudBackupCollectionRestoreJobCollection = Mongodbatlas.GetCloudBackupCollectionRestoreJobCollection.Invoke(new()
        {
            ProjectId = projectId,
            ClusterName = clusterName,
            JobId = jobId,
            SourceNamespace = sourceNamespace,
        });
    
        return new Dictionary<string, object?>
        {
            ["collectionStates"] = .Select(c => 
            {
                return 
                {
                    { "sourceNamespace", c.SourceNamespace },
                    { "targetNamespace", c.TargetNamespace },
                    { "effectiveTargetNamespace", c.EffectiveTargetNamespace },
                    { "state", c.State },
                    { "indexStatus", c.IndexStatus },
                    { "documents", $"{c.RestoredDocuments} / {c.TotalDocuments}" },
                };
            }).ToList(),
            ["collectionState"] = thisGetCloudBackupCollectionRestoreJobCollection.Apply(getCloudBackupCollectionRestoreJobCollectionResult => getCloudBackupCollectionRestoreJobCollectionResult.State),
        };
    });
    
    Example coming soon!
    
    Example coming soon!
    
    pulumi {
      required_providers {
        mongodbatlas = {
          source = "pulumi/mongodbatlas"
        }
      }
    }
    
    data "mongodbatlas_getcloudbackupcollectionrestorejobcollections" "this" {
      project_id   = projectId
      cluster_name = clusterName
      job_id       = jobId
    }
    data "std_coalesce" "invoke_1" {
      input = [data.mongodbatlas_getcloudbackupcollectionrestorejobcollections.this.results, []]
    }
    data "std_coalesce" "invoke_2" {
      input = [sourceNamespaceConfig, length(local.collections) > 0 ? local.collections[length(local.collections) - 1].source_namespace : null]
    }
    data "mongodbatlas_getcloudbackupcollectionrestorejobcollection" "thisGetCloudBackupCollectionRestoreJobCollection" {
      project_id       = projectId
      cluster_name     = clusterName
      job_id           = jobId
      source_namespace = local.sourceNamespace
    }
    
    # Per-collection read-back for the resolved collection restore job.
    locals {
      collections = data.std_coalesce.invoke_1.result
    }
    locals {
      sourceNamespace = data.std_coalesce.invoke_2.result
    }
    output "collectionStates" {
      value = [for c in local.collections : {
        "sourceNamespace"          = c.sourceNamespace
        "targetNamespace"          = c.targetNamespace
        "effectiveTargetNamespace" = c.effectiveTargetNamespace
        "state"                    = c.state
        "indexStatus"              = c.indexStatus
        "documents"                ="${c.restoredDocuments} / ${c.totalDocuments}"
      } ]
    }
    output "collectionState" {
      value = data.mongodbatlas_getcloudbackupcollectionrestorejobcollection.thisGetCloudBackupCollectionRestoreJobCollection.state
    }
    

    Further Examples

    • Restore job inspection
    • Snapshot restore
    • Point-in-time restore
    • Snapshot discovery

    Using getCloudBackupCollectionRestoreJobCollection

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getCloudBackupCollectionRestoreJobCollection(args: GetCloudBackupCollectionRestoreJobCollectionArgs, opts?: InvokeOptions): Promise<GetCloudBackupCollectionRestoreJobCollectionResult>
    function getCloudBackupCollectionRestoreJobCollectionOutput(args: GetCloudBackupCollectionRestoreJobCollectionOutputArgs, opts?: InvokeOutputOptions): Output<GetCloudBackupCollectionRestoreJobCollectionResult>
    def get_cloud_backup_collection_restore_job_collection(cluster_name: Optional[str] = None,
                                                           job_id: Optional[str] = None,
                                                           project_id: Optional[str] = None,
                                                           source_namespace: Optional[str] = None,
                                                           opts: Optional[InvokeOptions] = None) -> GetCloudBackupCollectionRestoreJobCollectionResult
    def get_cloud_backup_collection_restore_job_collection_output(cluster_name: pulumi.Input[Optional[str]] = None,
                                                           job_id: pulumi.Input[Optional[str]] = None,
                                                           project_id: pulumi.Input[Optional[str]] = None,
                                                           source_namespace: pulumi.Input[Optional[str]] = None,
                                                           opts: Optional[InvokeOutputOptions] = None) -> Output[GetCloudBackupCollectionRestoreJobCollectionResult]
    func LookupCloudBackupCollectionRestoreJobCollection(ctx *Context, args *LookupCloudBackupCollectionRestoreJobCollectionArgs, opts ...InvokeOption) (*LookupCloudBackupCollectionRestoreJobCollectionResult, error)
    func LookupCloudBackupCollectionRestoreJobCollectionOutput(ctx *Context, args *LookupCloudBackupCollectionRestoreJobCollectionOutputArgs, opts ...InvokeOption) LookupCloudBackupCollectionRestoreJobCollectionResultOutput

    > Note: This function is named LookupCloudBackupCollectionRestoreJobCollection in the Go SDK.

    public static class GetCloudBackupCollectionRestoreJobCollection 
    {
        public static Task<GetCloudBackupCollectionRestoreJobCollectionResult> InvokeAsync(GetCloudBackupCollectionRestoreJobCollectionArgs args, InvokeOptions? opts = null)
        public static Output<GetCloudBackupCollectionRestoreJobCollectionResult> Invoke(GetCloudBackupCollectionRestoreJobCollectionInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetCloudBackupCollectionRestoreJobCollectionResult> Invoke(GetCloudBackupCollectionRestoreJobCollectionInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetCloudBackupCollectionRestoreJobCollectionResult> getCloudBackupCollectionRestoreJobCollection(GetCloudBackupCollectionRestoreJobCollectionArgs args, InvokeOptions options)
    public static Output<GetCloudBackupCollectionRestoreJobCollectionResult> getCloudBackupCollectionRestoreJobCollection(GetCloudBackupCollectionRestoreJobCollectionArgs args, InvokeOptions options)
    public static Output<GetCloudBackupCollectionRestoreJobCollectionResult> getCloudBackupCollectionRestoreJobCollection(GetCloudBackupCollectionRestoreJobCollectionArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: mongodbatlas:index/getCloudBackupCollectionRestoreJobCollection:getCloudBackupCollectionRestoreJobCollection
      arguments:
        # arguments dictionary
    data "mongodbatlas_get_cloud_backup_collection_restore_job_collection" "name" {
        # arguments
    }

    The following arguments are supported:

    ClusterName string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    JobId string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    SourceNamespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    ClusterName string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    JobId string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    SourceNamespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    cluster_name string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    job_id string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    project_id string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    source_namespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    clusterName String
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    jobId String
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    projectId String
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    sourceNamespace String
    Source namespace that identifies the collection to return (e.g. db.collection).
    clusterName string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    jobId string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    projectId string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    sourceNamespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    cluster_name str
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    job_id str
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    project_id str
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    source_namespace str
    Source namespace that identifies the collection to return (e.g. db.collection).
    clusterName String
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    jobId String
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    projectId String
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    sourceNamespace String
    Source namespace that identifies the collection to return (e.g. db.collection).

    getCloudBackupCollectionRestoreJobCollection Result

    The following output properties are available:

    ClusterName string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    EffectiveTargetNamespace string
    Actual target namespace after restore (e.g. after conflict rename).
    IndexStatus GetCloudBackupCollectionRestoreJobCollectionIndexStatus
    Index build status for a collection within a restore job.
    JobId string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    RestoredDocuments int
    Number of documents restored so far.
    SourceNamespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    State string
    Current state of this collection within the restore job.
    TargetNamespace string
    Requested target namespace for the restored collection.
    TotalDocuments int
    Total document count for this collection.
    ClusterName string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    EffectiveTargetNamespace string
    Actual target namespace after restore (e.g. after conflict rename).
    IndexStatus GetCloudBackupCollectionRestoreJobCollectionIndexStatus
    Index build status for a collection within a restore job.
    JobId string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    ProjectId string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    RestoredDocuments int
    Number of documents restored so far.
    SourceNamespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    State string
    Current state of this collection within the restore job.
    TargetNamespace string
    Requested target namespace for the restored collection.
    TotalDocuments int
    Total document count for this collection.
    cluster_name string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    effective_target_namespace string
    Actual target namespace after restore (e.g. after conflict rename).
    index_status object
    Index build status for a collection within a restore job.
    job_id string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    project_id string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    restored_documents number
    Number of documents restored so far.
    source_namespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    state string
    Current state of this collection within the restore job.
    target_namespace string
    Requested target namespace for the restored collection.
    total_documents number
    Total document count for this collection.
    clusterName String
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    effectiveTargetNamespace String
    Actual target namespace after restore (e.g. after conflict rename).
    indexStatus GetCloudBackupCollectionRestoreJobCollectionIndexStatus
    Index build status for a collection within a restore job.
    jobId String
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    projectId String
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    restoredDocuments Integer
    Number of documents restored so far.
    sourceNamespace String
    Source namespace that identifies the collection to return (e.g. db.collection).
    state String
    Current state of this collection within the restore job.
    targetNamespace String
    Requested target namespace for the restored collection.
    totalDocuments Integer
    Total document count for this collection.
    clusterName string
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    effectiveTargetNamespace string
    Actual target namespace after restore (e.g. after conflict rename).
    indexStatus GetCloudBackupCollectionRestoreJobCollectionIndexStatus
    Index build status for a collection within a restore job.
    jobId string
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    projectId string
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    restoredDocuments number
    Number of documents restored so far.
    sourceNamespace string
    Source namespace that identifies the collection to return (e.g. db.collection).
    state string
    Current state of this collection within the restore job.
    targetNamespace string
    Requested target namespace for the restored collection.
    totalDocuments number
    Total document count for this collection.
    cluster_name str
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    effective_target_namespace str
    Actual target namespace after restore (e.g. after conflict rename).
    index_status GetCloudBackupCollectionRestoreJobCollectionIndexStatus
    Index build status for a collection within a restore job.
    job_id str
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    project_id str
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    restored_documents int
    Number of documents restored so far.
    source_namespace str
    Source namespace that identifies the collection to return (e.g. db.collection).
    state str
    Current state of this collection within the restore job.
    target_namespace str
    Requested target namespace for the restored collection.
    total_documents int
    Total document count for this collection.
    clusterName String
    Human-readable label that identifies the cluster with the collection restore job you want to return.
    effectiveTargetNamespace String
    Actual target namespace after restore (e.g. after conflict rename).
    indexStatus Property Map
    Index build status for a collection within a restore job.
    jobId String
    Unique 24-hexadecimal digit string that identifies the collection restore job.
    projectId String
    Unique 24-hexadecimal digit string that identifies your project, also known as groupId in the official documentation.
    restoredDocuments Number
    Number of documents restored so far.
    sourceNamespace String
    Source namespace that identifies the collection to return (e.g. db.collection).
    state String
    Current state of this collection within the restore job.
    targetNamespace String
    Requested target namespace for the restored collection.
    totalDocuments Number
    Total document count for this collection.

    Supporting Types

    GetCloudBackupCollectionRestoreJobCollectionIndexStatus

    ErrorMessage string
    Error message if index build failed.
    FailedIndexes List<string>
    List of index specifications that failed to build (up to 64 items).
    State string
    Index build state indicating the status of index creation during or after a restore operation.
    ErrorMessage string
    Error message if index build failed.
    FailedIndexes []string
    List of index specifications that failed to build (up to 64 items).
    State string
    Index build state indicating the status of index creation during or after a restore operation.
    error_message string
    Error message if index build failed.
    failed_indexes list(string)
    List of index specifications that failed to build (up to 64 items).
    state string
    Index build state indicating the status of index creation during or after a restore operation.
    errorMessage String
    Error message if index build failed.
    failedIndexes List<String>
    List of index specifications that failed to build (up to 64 items).
    state String
    Index build state indicating the status of index creation during or after a restore operation.
    errorMessage string
    Error message if index build failed.
    failedIndexes string[]
    List of index specifications that failed to build (up to 64 items).
    state string
    Index build state indicating the status of index creation during or after a restore operation.
    error_message str
    Error message if index build failed.
    failed_indexes Sequence[str]
    List of index specifications that failed to build (up to 64 items).
    state str
    Index build state indicating the status of index creation during or after a restore operation.
    errorMessage String
    Error message if index build failed.
    failedIndexes List<String>
    List of index specifications that failed to build (up to 64 items).
    state String
    Index build state indicating the status of index creation during or after a restore operation.

    Package Details

    Repository
    MongoDB Atlas pulumi/pulumi-mongodbatlas
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the mongodbatlas Terraform Provider.
    mongodbatlas logo mongodbatlas logo
    Viewing docs for MongoDB Atlas v4.15.0
    published on Friday, Aug 28, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial