# How to restore to a different collection using PerconaServerMongoDBRestore CR

**URL:** <https://forums.percona.com/t/how-to-restore-to-a-different-collection-using-perconaservermongodbrestore-cr/40327>\
**Category:** Percona Operator for MongoDB\
**Tags:** psmdb-operator\
**Created:** [March 3, 2026, 11:55am UTC](https://forums.percona.com/t/how-to-restore-to-a-different-collection-using-perconaservermongodbrestore-cr/40327 "2026-03-03T11:55:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![psamagal](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/psamagal/32/13495_2.png) [@psamagal](https://forums.percona.com/u/psamagal)\
**Post date:** [March 3, 2026, 11:55am UTC](https://forums.percona.com/t/how-to-restore-to-a-different-collection-using-perconaservermongodbrestore-cr/40327/1 "2026-03-03T11:55:57Z")

</div>

Hello everyone,

I am trying to determine whether it is possible to restore a single MongoDB collection to a specific point in time using the **Percona Operator for MongoDB** on Kubernetes, specifically through the **PerconaServerMongoDBRestore** Custom Resource (CR).

My goal is to restore only one collection, but into a different target collection name (not overwriting the original). Essentially, I am looking for functionality equivalent to the following PBM CLI command:

```auto
pbm restore --time=<timestamp> \
  --ns-from=testPerf.usertable \
  --ns-to=testPerf.usertable_v2

```

After reviewing the Percona Operator documentation, I did not find any references to this type of namespace remapping during restore.

Is this type of restore (point-in-time restore of a single collection into a different collection name) supported when using the Operator and the Restore CR? If so, could you please clarify how this can be achieved?

My current version of the operator is v1.20.1 with MongoDB 7.0.28

In this part, of the _selective.namespaces_ I was expecting to be able to pass the _ns-from_ and the _ns-to,_ in order to create a parallel collection on the replica set. But nothing is documented (even in more recent versions)

```auto
 pitr:
    type: date
    date: "<TIMESTAMP>" # FORMAT YYYY-MM-DD hh:mm:ss
  selective:
    namespaces: ["<DATABASE.COLLECTION_NAME_1>"]

```

Best regards,  
Paulo

---

<div class="post-metadata">

**Author:** ![radoslaw.szulgo](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/radoslaw.szulgo/32/17315_2.png) [@radoslaw.szulgo](https://forums.percona.com/u/radoslaw.szulgo)\
**Post date:** [March 3, 2026, 12:59pm UTC](https://forums.percona.com/t/how-to-restore-to-a-different-collection-using-perconaservermongodbrestore-cr/40327/2 "2026-03-03T12:59:14Z")

</div>

No, it’s not yet possible. As a workaround you need to use `pbm` from the pod itself.

---

<div class="post-metadata">

**Author:** ![anderson.nogueira](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/anderson.nogueira/32/23141_2.png) [@anderson.nogueira](https://forums.percona.com/u/anderson.nogueira)\
**Post date:** [March 3, 2026, 1:01pm UTC](https://forums.percona.com/t/how-to-restore-to-a-different-collection-using-perconaservermongodbrestore-cr/40327/3 "2026-03-03T13:01:27Z")

</div>

Hi @psamagal,

As @radoslaw.szulgo mentioned, this isn’t supported through the CR yet. The `selective.namespaces` field only controls which collections to include in the restore; it does not remap them to different names. This is a gap between what PBM supports at the CLI level and what the operator CR exposes.

The good news is that PBM supports exactly what you need since version 2.8.0, and your operator v1.20.1 bundles PBM 2.9.1. You can run PBM directly from inside the backup-agent sidecar. I tested this on a 3-node replica set with PBM 2.12.0 and confirmed that PITR restore with namespace remapping works:

```bash
# exec into the backup-agent sidecar on one of the RS pods
kubectl exec -it <cluster-name>-rs0-0 -c backup-agent -- \
  pbm restore --base-snapshot <backup-name> \
    --time 2026-03-01T14:30:00 \
    --ns-from=testPerf.usertable \
    --ns-to=testPerf.usertable_v2

```

Replace `<cluster-name>` with your PSMDB cluster name and `<backup-name>` with the logical backup name (check `pbm list` from inside the container). The `--time` flag uses `YYYY-MM-DDTHH:MM:SS` format without timezone suffix.

A few constraints: you can only remap one collection per restore, it must be unsharded, and the target collection name must not already exist. Indexes (including TTL indexes) are preserved on the renamed collection. These constraints are documented in [PBM selective restore docs](https://docs.percona.com/percona-backup-mongodb/usage/restore-selective).

One caveat: the operator won’t track this restore operation, so you won’t see status in `kubectl get psmdb-restore`. For a single collection rename this is fine, but avoid running operator-managed restores and manual PBM restores at the same time.

Consider filing a feature request at [perconadev.atlassian.net](https://perconadev.atlassian.net) under the K8SPSMDB project to add `nsFrom`/`nsTo` to the restore CR’s `selective` section. PBM already supports it; the operator just needs to pass those fields through.

References:

- [Operator restore CR options](https://docs.percona.com/percona-operator-for-mongodb/restore-options)

---

<div class="post-metadata">

**Author:** ![psamagal](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/psamagal/32/13495_2.png) [@psamagal](https://forums.percona.com/u/psamagal)\
**Post date:** [March 3, 2026, 1:29pm UTC](https://forums.percona.com/t/how-to-restore-to-a-different-collection-using-perconaservermongodbrestore-cr/40327/4 "2026-03-03T13:29:16Z")

</div>

Many thanks for the confirmation.

sadly, I don’t appear to have permissions to do it on Jira project refered

---

<div class="post-metadata">

**Author:** ![anderson.nogueira](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/anderson.nogueira/32/23141_2.png) [@anderson.nogueira](https://forums.percona.com/u/anderson.nogueira)\
**Post date:** [March 3, 2026, 4:25pm UTC](https://forums.percona.com/t/how-to-restore-to-a-different-collection-using-perconaservermongodbrestore-cr/40327/5 "2026-03-03T16:25:48Z")

</div>

I’ve created [K8SPSMDB-1603](https://perconadev.atlassian.net/browse/K8SPSMDB-1603) to track adding `--ns-to` (namespace remapping) support to the PerconaServerMongoDBRestore CR. You can watch it for updates.
