Hi there!
Since there wasn’t a reply to your message, I tried to run it by our AI bot. Here is the response I got 
Based on the file structure you’ve described, it appears you have a backup that combines elements from different MongoDB backup methods. The .json.gz files are likely from mongoexport, while the metadata.json file is typically associated with mongodump output. To restore this backup, we’ll need to use a combination of mongoimport and mongorestore. 1
Here’s a step-by-step procedure to restore your backup:
1. Prepare the Data
First, you need to extract the .json.gz files:
bash
gunzip -r <downloadFolder>
2. Import the Collection Data
Use mongoimport to import the JSON files into your MongoDB instance:
bash
mongoimport --uri "<connectionString>" --mode=upsert -d <database_name> -c <collection_name> --file <path_to_json_file> --type json
Repeat this command for each .json file in your backup.
3. Restore Indexes and Other Metadata
Use mongorestore to restore the metadata, which includes index information:
bash
mongorestore --uri "<connectionString>" --db <database_name> --collection <collection_name> <path_to_metadata.json>
1 2
4. Verify the Restoration
After completing these steps, connect to your MongoDB instance and verify that the collection has been restored correctly, including all documents and indexes.
Important Considerations:
- The
--mode=upsert option in the mongoimport command allows handling of duplicate documents from the archive. 1
- Make sure you have sufficient permissions to perform these operations on the target database.
- If you’re restoring to a replica set or sharded cluster, ensure you’re connecting to the primary node or a
mongos instance.
- Be cautious when restoring to an existing database/collection, as this process may overwrite existing data. Consider restoring to a temporary database first for verification before replacing your production data.
- If you encounter any issues with index recreation, you may need to manually create the indexes using the information from the
metadata.json file.
By following these steps, you should be able to restore your single collection backup successfully. Remember to adjust the database name, collection name, and file paths according to your specific backup files and target MongoDB instance. 1 2
Sources
Import Archive from S3
Docs Home
MongoDB Atlas
Backup, Restore, and Archive
Restore a Collection from Queryable Legacy Backup
MongoDB Atlas
Backup, Restore, and Archive
Legacy Backups (Deprecated)