2

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

Community
  • 1
  • 1
zish
  • 607
  • 2
  • 6
  • 15

2 Answers2

12

You can just add gzip to the restore command:

mongorestore --gzip --db projectx userprofiles/
JAR.JAR.beans
  • 9,668
  • 4
  • 45
  • 57
3

Okay I have got my answer first of all I converted the extension of my gunzipped file to bson by using command

gunzip -c userprofiles.gz > users.bson

after that I used mongorestore command

mongorestore --db projectx userprofiles/

Thats it

zish
  • 607
  • 2
  • 6
  • 15