Restore single collection with different name

Hi Team,

  1. How to restore signle collection with different name using mongorestore in same database?
  2. How to restore signle collection with different name using MongoDB compass in same database?
    example:
    Original collection name: Employees
    Different Name (backup) : Employee_backup

While restoring i don’t want to over write original collection.

Have you tried using the --db and --collection arguments from my best friend the mongorestore documentation? Other options related to your use-case are --nsFrom and --nsTo.

It looks like it will do what you want.

2 Likes