Version 3.12.1

4.3.5. MongoDB

For restoring MongoDB dump use the standard `mongorestore` tool. Detailed information can be found in the official MongoDB documentation

In general terms, the recovery order will be as follows: unarchive the backup, then restore it using the `mongorestore` tool.

Step-by-step instruction:

1. Unarchive the backup to tmp directory:

    $ tar -xvf /var/nxs-backup/db/mongo/production/prod/daily/prod_2022-09-02_02-12.tar.gz 
    -C /var/nxs-backup/tmp/mongoresore

2. Perform the recovery:

    # basic backup restore with collections drop
    $ mongorestore --drop --dir /var/nxs-backup/tmp/mongoresore/dump/prod

    # Restore only provided specific namespaces (collections) list
    $ mongorestore --drop --dir /var/nxs-backup/tmp/mongoresore/dump/prod --nsInclude sessions.collection'

    # Restore database without list of namespaces (collections)
    $ mongorestore --drop --dir /var/nxs-backup/tmp/mongoresore/dump/prod --nsExclude sessions.collection'