Shell and server versions do not match

I tried to upgrade from Community Edition 4.2.8 to Enterprise Edition 4.4 by replacing the existing binaries as described here.
https://docs.mongodb.com/manual/release-notes/4.4-upgrade-standalone/

MongoDB shell version was updated to v4.4.0, but MongoDB server version is still 4.2.8. How can I solve this?

  1. Make sure you restarted the MongoDB instance.
  2. Check that you don’t have another version of MongoDB installed in your PC and this version takes priority in the $PATH. Type mongod --version to check.
  3. Did you run this command? db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )

Thank you, Maxime !

  1. Yes

  2. It works and I get this response.

    db version v4.4.0
    Build Info: {
      “version”: “4.4.0”,
      “gitVersion”: “563487e100c4215e2dce98d0af2a6a5a2d67c5cf”,
      “modules”: [
      “enterprise”
      ],
      “allocator”: “system”,
      “environment”: {
      “distarch”: “x86_64”,
      “target_arch”: “x86_64”
      }
    }
  1. I tried and got this error.
{
    “ok” : 0,
    “errmsg” : "Invalid command argument. Expected ‘4.2’ or ‘4.0’, found 4.4 in: { setFeatureCompatibilityVersion: “4.4”, lsid: { id: UUID(“39820014-601d-4a26-a816-51adac01dc04”) }, $db: “admin” }. See https://docs.mongodb.com/manual/release-notes/4.2-compatibility/#feature-compatibility.",
    “code” : 2,
    “codeName” : “BadValue”
}

Well if you are still running the server in 4.2.8 it’s because the 4.2.8 binary is still installed somewhere in your computer and when you are starting the mongod process, you are not using the binary 4.4.0 binary you just installed.

I would suggest the following to find the hidden binary:

  1. Identify the PID of the mongod that is currently running in your PC.
$ ps aux | grep mongod
999        56703  1.3  0.7 1903520 123556 ?      Ssl  02:12   0:02 mongod --replSet=test --bind_ip_all
polux      57291  0.0  0.0   6244   660 pts/1    S+   02:15   0:00 grep --color=auto mongod

In my exemple, it’s 56703 here.

  1. Find the binary running this PID:
$ sudo ls -l /proc/56703/exe 
[sudo] password for polux: 
lrwxrwxrwx 1 999 docker 0 Sep  9 02:12 /proc/56703/exe -> /usr/bin/mongod

Then I bet if you take this path and check the version, you will probably get 4.2.8.

/usr/bin/mongod --version

I did this little test with a mongod running in Docker but I’m guessing you installed MongoDB using the package manager of your system and I guess you are not running the binary you think you are running.

Please make sure to make a backup of your database before you upgrade - just in case :slight_smile: !

I can identify PID, but the second step does not find anything. After entering my password, it says ls: ./proc/<PID>/exe: No such file or directory

Which OS are you using? Maybe it’s slightly different from my Debian. What do you have in the /proc/<PID>/ folder?

Also I see you have an extra “dot” in your error, are in sure you are pointing to the right file?
It’s $ sudo ls -l /proc/<PID>/exe.
Not $ sudo ls -l ./proc/<PID>/exe.

macOS Catalina. I can’t find /proc. I tried both /proc and ./proc after your previous message, and happened to copy the error message with a dot.

Ohh that’s not Linux my friend! I never touched a Mac in my life so I won’t do any better than Google on this one I guess.
If you see that your mongod is still running in 4.2.8, that’s because 4.2.8 is installed somewhere in your computer and it’s the one that you are starting.
Maybe you can find this binary with find?

$ find / -name "mongod" 2> /dev/null
/home/polux/Softwares/mongodb-linux-x86_64-enterprise-debian10-4.2.8/bin/mongod
/home/polux/Softwares/mongodb-linux-x86_64-enterprise-debian10-4.4.0/bin/mongod

That’s where I install MongoDB in my PC but maybe you have 4.2.8 that was installed with MacOS package manager and 4.4.0 installed manually?

How do you start the “mongod” process?