Mongodump: Error parsing command line: unrecognised option '--uri'

Hello everyone,
I am trying to achieve a database dump using this command:

mongodump --uri
mongodb+srv://ACC_NAME:PASSWORD@cluster0.fklgt.mongodb.net/DATABASE_NAME

But, I keep getting this error:

Error parsing command line: unrecognised option ‘–uri’


CONTEXT:

I have done this several times before on my local machine. And now I am attempting to do this on a VPS where I am installing mongodb from scratch.

I tried installing it following the official documentation until I reached this step:

sudo apt-get install -y mongodb-org

Which throws this error:

E: Unable to locate package mongodb-org

After doing some research, I have found this stackoverflow question where most answers say that I should just:

At first try with this command: sudo apt-get install -y mongodb

This is the unofficial mongodb package provided by Ubuntu and it is
not maintained by MongoDB and conflict with MongoDB’s offically
supported packages.

So I did exactly that, and the rest is what I explained earlier in this post.


mongo --version
MongoDB shell version: 2.6.10

mongod --version
db version v2.6.10

hostnamectl
Operating System: Ubuntu 16.04.7 LTS
Kernel: Linux 4.4.0-210-generic
Architecture: x86-64

The dash above seems weird. It is supposed to be 2 short dashes but you have a single long one. It looks like a cut-n-paste issue. Make sure you type --uri on the keyboard rather than cut-n-paste.

Hi @Ghrib_Ahmed,

You need to update to modern versions of the MongoDB Database Tools (mongodump, mongorestore, …) that are compatible with current server releases. MongoDB 2.6 was first released in March, 2014 and reached end of life in October, 2016. MongoDB 2.6 tools predate the addition of the --uri parameter and support for mongodb+srv connection strings.

For more information please see Installing the Database Tools on Linux.

After doing some research, I have found this stackoverflow question

Most of the discussion on this question is from 2015 (MongoDB 3.0) and very outdated compared to current server releases.

Regards,
Stennie

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.