I am an absolute beginner in mongoDB. I am trying to import the sample data using mongorestore by doing the following:
C:\Users\hp\Downloads\mongodb-database-tools-windows-x86_64-100.3.1\mongodb-database-tools-windows-x86_64-100.3.1\bin>mongorestore --nsInclude=exampleDb C:\Users\hp\Desktop\aqa-test-tools\TestResultSummaryService\data\sampleData.gz
But I am getting the following error continuously:
2021-07-15T20:24:07.485+0530 Failed: file C:\Users\hp\Desktop\aqa-test-tools\TestResultSummaryService\data\sampleData.gz does not have .bson extension
2021-07-15T20:24:07.487+0530 0 document(s) restored successfully. 0 document(s) failed to restore.
Then I also came to know that my file is unzipped, so for that I also tried doing:
mongorestore --gzip --nsInclude='exampleDb.*' C:\Users\hp\Desktop\aqa-test-tools\TestResultSummaryService\data\sampleData.gz
But the output remains the same.
I am using the mongoDB version 4.4.6 Can anyone tell me where and what am I doing wrong? Thank You
It looks like you are trying to restore a zipped file as for the path you have given to mongorestore tool:
C:\Users\hp\Desktop\aqa-test-tools\TestResultSummaryService\data\sampleData.gz
You can add the flag --gzip to sort the problem out.
mongorestore --gzip ...
As an alternative you can unzip the file on your machine and restore the output.