2

i got a problem with MongoDB. I installed it on my linux server with sudo apt-get install mongodb. When i now try to connect with my java driver to it, it says

Caused by: com.mongodb.MongoIncompatibleDriverException: This version of the driver is not compatible with one or more of the servers to which it is connected: ClusterDescription{type=STANDALONE, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=127.0.0.1:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[2, 4, 10]}, minWireVersion=0, maxWireVersion=0, maxDocumentSize=16777216, roundTripTimeNanos=708358}]}

My mongodb version on the server semms to be older than my driver version. My java driver version is 3.6 mongo-version shows me 2.4

How i could solve this problem ?

1
  • 3.6 was the newest for me. Commented Jan 31, 2018 at 14:14

3 Answers 3

1

in case of you are using Docker to wrap your database, I suggest to change your ubuntu version to the 16.04LTS and then your mongod will install the 2.6.10 by default.

It's enough to run with java Driver, no need to get the 3.x.

here is Dockerfile :

FROM ubuntu:16.04

RUN apt-get update && apt-get install -yq mongodb && apt-get clean && rm -rf /var/lib/apt/lists/*

ENTRYPOINT mongod --dbpath /data/db --rest
Sign up to request clarification or add additional context in comments.

Comments

0

The default mongodb package for Ubuntu is (as of 2018) version 2.4. This is a fairly old version, not compatible with a 3.x client or java driver.

Judging from your question, I assume you're not committed to a legacy version, so you'll probably want to use version 3.x

This requires some more work than just typing apt install. You can follow the recipe on the MongoDB website:

https://docs.mongodb.com/tutorials/install-mongodb-on-ubuntu/

Comments

0

Try to remove the old version:

sudo apt-get purge --auto-remove mongodb-server

Then follow https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/ to install the newest official version.

1 Comment

Problem has been solved. I installed mongodb with downloading the files and installing them manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.