How to restore gzipped Monogdb single collection?

zish picture zish · May 6, 2016 · Viewed 9.6k times · Source

Hye everyone, I am new to mongodb I dumped one of my collection using following command mongodump --db somedb --collection somecollection --out - | gzip > collectiondump.gz given on the link now when I try to restore it using mongorestore it gives Error dont know what to do with file.

kindly help me I used this way because the answer in the given link got too much upvotes

Error image

Answer

JAR.JAR.beans picture JAR.JAR.beans · Jun 8, 2017

You can just add gzip to the restore command:

mongorestore --gzip --db projectx userprofiles/