Skip to content

Comments

PBM-1294 selective logical backup/restore with Users & Roles#337

Open
rasika-chivate wants to merge 41 commits intomainfrom
PBM-1294-selective-logical-backup/restore-with-Users-&-Roles
Open

PBM-1294 selective logical backup/restore with Users & Roles#337
rasika-chivate wants to merge 41 commits intomainfrom
PBM-1294-selective-logical-backup/restore-with-Users-&-Roles

Conversation

@rasika-chivate
Copy link
Collaborator

@rasika-chivate rasika-chivate commented Feb 9, 2026

Provide a detailed documentation of the command used for selective backup and restore. Include instructions on how to optionally include related users and roles in the backup and restoration process. Ensure that all syntax, parameters, and examples are clearly explained.

Refer to the ticket PBM-1294 for more information.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

@jcechace jcechace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Few things

  • consider explicitly mentionn that --with-users-and-roles requires a collection wildcard (so --ns='test.*' is ok, but --ns='test.col' is not
  • describe when --with-users-and-roles is required for pbm restore (in general only if --ns is used) see percona/percona-backup-mongodb#1260

But these are just options

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


#### Overview

Percona Backup for MongoDB allows you to perform selective restore of databases and collections. Additionally, you can choose to include **users and roles defined** in the database in your selective backup, ensuring that access control is restored along with the data.
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the restore section, but it says 'include ... in your selective backup'. Suggest rewording to 'include ... in your selective restore' (or 'restore users and roles alongside the data') to avoid confusion.

Suggested change
Percona Backup for MongoDB allows you to perform selective restore of databases and collections. Additionally, you can choose to include **users and roles defined** in the database in your selective backup, ensuring that access control is restored along with the data.
Percona Backup for MongoDB allows you to perform selective restore of databases and collections. Additionally, you can choose to include **users and roles defined** in the database in your selective restore, ensuring that access control is restored along with the data.

Copilot uses AI. Check for mistakes.

Percona Backup for MongoDB enables you to perform selective backups of databases and collections. Also, you can choose to include **users and roles defined** in the database in your selective backup, ensuring that access control is restored along with the data.

To back up a specific namespace and include users and roles, run the following command:
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The restore page documents important constraints for --with-users-and-roles (e.g., requiring a collection wildcard like mydb.*, excluding cluster/global users/roles, and overwrite behavior on restore). This backup page currently doesn’t call out the wildcard requirement or explicitly clarify the same scope limitation (db-scoped only). Suggest adding a short warning/note here for consistency so users don’t try --ns=\"db.collection\" or assume cluster-wide users/roles are included.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Multi-format is the default data format for both full and selective backups since it allows selective restore. Note, however, that you can make only full restores from backups made with earlier versions of Percona Backup for MongoDB.

## Selective backup with users and roles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an extra short section should be also under general description + version when feature (selective backup AND restore with users/roles) is added https://docs.percona.com/percona-backup-mongodb/features/selective-backup.html or at least this section should be rewritten https://docs.percona.com/percona-backup-mongodb/features/selective-backup.html#restore-a-database-with-users-and-roles

Comment on lines +56 to +57
```sh
pbm backup --ns="invoices.*" --with-users-and-roles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point to provide same command twice? Here and above?
pbm backup --ns="mydb.*" --with-users-and-roles

```

This command backs up all collections in the **invoices** database, along with its users and roles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This restriction isn't mentioned

pbm backup --ns=test.test --with-users-and-roles
Error: parse --with-users-and-roles option: Including users and roles are not allowed for specific collection. Use --ns='db.*' to specify the whole database instead

pbm restore <backup_name> --ns <database.*> --with-users-and-roles
```

### Selective restore with users and roles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both restores either from full backup or from selective backup are considered as selective restore if --ns option is used. This section should be merged with prev one as it duplicate. We need just add an extra note that now it's possible to do selective restore with users and roles not only from full backup but also from selective backup (if it actually contains u&r).

Also there is no note that now u&r are also restored if selected PITR restore is selected https://perconadev.atlassian.net/browse/PBM-1521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants