MongoDB 3.6 → 5.0 Direct Upgrade Fails with WiredTiger Metadata Compatibility Error

I tried to upgrade MongoDB directly from 3.6 to 5.0 by stopping the MongoDB service, installing the new binaries, and restarting mongod with the existing data files.

However, MongoDB failed to start and produced the following error:

{“t”:{“$date”:“2025-07-29T08:15:05.256+00:00”},“s”:“F”,“c”:“STORAGE”,“id”:4671205,“ctx”:“initandlisten”,“msg”:“This version of MongoDB is too recent to start up on the existing data files. Try MongoDB 4.2 or earlier.”}

{“t”:{“$date”:“2025-07-28T08:15:05.256+00:00”},“s”:“F”,“c”:“-”,“id”:23091,“ctx”:“initandlisten”,“msg”:“Fatal assertion”,“attr”:{“msgid”:4671205,“file”:“src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp”,“line”:653}}

***aborting after fassert() failure

Additionally, the system generated a core dump:
Jul 29 09:04:17 corecomp.com systemd-coredump[169166]: Process 169160 (mongod) of user 991 dumped core.
Jul 29 09:04:17 abc.corecomp.com sh[169156]: ERROR: child process failed, exited with 51

**Steps Performed :

  1. Stopped MongoDB 3.6
  2. Installed MongoDB 5.0 binaries
  3. Tried to start mongod with the existing data directory

Environment Details:

OS: RHEL 8.10
MongoDB Old Version: 3.6.x
MongoDB New Version: 5.0.x
WiredTiger Storage Engine