Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB shell and server do not match

Tags:

mongodb

I'm trying to connect to an mlab database, but when I run the command

mongodb://ds119508.mlab.com:19508/myDb -u myUser -p myPass

It always prompts this message:

MongoDB shell version v3.4.0 connecting to: mongodb://ds119508.mlab.com:19508/heroku_xnz5tw94 MongoDB server version: 3.2.11 WARNING: shell and server versions do not match

I'd like to get rid of that. I'm sure I've been installing the 3.4 version by using this guide

Thanks in advance for help.

like image 987
Koop4 Avatar asked Dec 10 '16 10:12

Koop4


People also ask

How do I start MongoDB server shell?

To open up the MongoDB shell, run the mongo command from your server prompt. By default, the mongo command opens a shell connected to a locally-installed MongoDB instance running on port 27017 . Try running the mongo command with no additional parameters: mongo.

Can not connect to MongoDB?

These are some of the solutions: Ensure that your MongoDB instance is running: Compass must connect to a running MongoDB instance. Also check you have installed MongoDB and have a running mongod process. You should also check that the port where MongoDB is running matches the port you provide in the compass connect.

Which file run the MongoDB shell?

mongorc. js File. When starting, mongo checks the user's HOME directory for a JavaScript file named .


2 Answers

I have also encountered with this problem. And it was caused by upgrading mongodb without shutting mongo server down.

Now that you've already have the new version of mongodb (tell from the mongo shell version). You can solve it by just restarting the mongod process.

For starting and stopping mongo process, see https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes

like image 107
Yao Ming Avatar answered Oct 22 '22 06:10

Yao Ming


There are probably multiple mongodb versions installed in your machine. I had a similar problem (I uninstalled the old version but not completely) and I followed this link (https://medium.com/@rajanmaharjan/uninstall-mongodb-macos-completely-d2a6d6c163f9) to uninstall all versions of mongodb and reinstall the most updated version and it worked.

like image 4
Chenlu Avatar answered Oct 22 '22 07:10

Chenlu