From time to time, when I upgrade my standalone Unifi controller (running in FreeBSD jail), I run into an issue which requires some manual action to resolve. The issue manifests as MongoDB (bundled with Unifi controller) refusing to start with existing data. Checking logs (/usr/local/share/java/unifi/logs/mongod.log) I can see the following (this log file is in JSON format - not particularly friendly for humans but still readable):
{"t":{"$date":"2025-02-01T21:39:17.097+00:00"},"s":"F", "c":"CONTROL", "id":20573, "ctx":"initandlisten","msg":"Wrong mongod version","attr":{"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: Location4926900: Invalid featureCompatibilityVersion document in admin.system.version: { _id: \"featureCompatibilityVersion\", version: \"4.4\" }. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility. :: caused by :: Invalid feature compatibility version value, expected '5.0' or '5.3' or '6.0. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility.). If the current featureCompatibilityVersion is below 5.0, see the documentation on upgrading at https://docs.mongodb.com/master/release-notes/5.0/#upgrade-procedures."}}
I'm not very experienced with MongoDB and this message looks rather obscure and scary. Fortunately so far it was fairly easy to fix.