Matt_Durr
(Matt Durr)
5
I encountered this error after trying to upgrade my dev mongod from 4.2 to 6.0 using Homebrew. Went through many many iterations of uninstall, reinstall, tracking down misc files to remove, restarting, etc. After many hours and troubleshooting with ChatGPT, the following worked for me.
Turned on live log:
tail -f $(brew --prefix)/var/log/mongodb/mongo.log
which surfaced this error:
"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: Location4926900: Invalid featureCompatibilityVersion document in admin.system.version: { _id: "featureCompatibilityVersion", version: "4.2" }.
ChatGPT suggested a scaled upgrade from 1 version to next, setting the featureCompatibilityVersion with each step.
Since this is a dev box, I went with the nuclear option instead. I didn’t even realize there were still 4.2 files lingering out there.
1 - First, stop any running MongoDB services:
brew services stop mongodb-community@5.0
2 - Delete the MongoDB database files and log files:
rm -rf $(brew --prefix)/var/mongodb/*
rm -rf $(brew --prefix)/var/log/mongodb/*
3 - Switch back to MongoDB 6.0:
brew uninstall mongodb-community@5.0
brew install mongodb-community@6.0
4 - Start fresh with 6.0:
brew services start mongodb-community@6.0
And it worked!
3 Likes