Unrecognised option '--gzip' in mongorestore

Hi, I tried to import the sample data for M220J but got this error. Any idea?

$ mongorestore --gzip --archive=sampledata.archive.gz
Error parsing command line: unrecognised option ‘–gzip’

Hi @Minh_Nguyen4 and welcome to the MongoDB community forums.

Can you please post the full results of running mongorestore --version? It seems strange that the option is not being recognized.

1 Like

Thanks, I installed mongodb in Ubuntu. This is the mongostore version
$ mongorestore --version
version 2.6.10

Yikes! That’s a very old version of mongorestore which was installed with a very old version of the MongoDB database engine. This is why you’re getting an error when trying to use the --gzip option. It really didn’t exist in the tool at that time. Version 2.6.x reached end of life around 5 years ago. I would recommend downloading or installing a recent version of MongoDB. I’m not sure how you installed that old of a version of MongoDB on Ubuntu. I believe that there are issues installing on Ubuntu 22.04, but there are some threads here on the forums with workarounds.

Note that the most recent version of mongorestore is 100.5.4.

1 Like

Hmm, I’m install it using apt-get like below. Shouldn’t it install the latest?
sudo apt-get install mongodb

Hi @Minh_Nguyen4,

What O/S version are you using? The 2.6 mongodb package is likely the default in that O/S distro; official MongoDB packages for Linux will be prefixed with mongodb-org (Community Server edition) or mongodb-enterprise (Enterprise Server edition).

To install MongoDB Community Server, please see the relevant instructions on: Install MongoDB Community Edition on Linux. The Platform Support Matrix in the MongoDB Production Notes indicates O/S and official MongoDB package support.

As Doug mentioned, the Database Tools (mongodump, mongorestore, …) are now separately versioned and packaged from the MongoDB Server. For more information see Installing the Database Tools on Linux.


1 Like

Thank you Doug and Stennie! I will try that.

Also, my suggestion is to add a note in M220J about the minimum version for the local installation command.