We have a pod running a MongoDB instance. It was automatically upgraded this morning to 7.0.1 and now wont restart citing;
initandlisten","msg":"Wrong mongod version","attr":{"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: Location4926900: Invalid featureCo │
│ mpatibilityVersion document in admin.system.version: { _id: \"featureCompatibilityVersion\", version: \"5.0\" }. See https://docs.mongodb.com/master/release-notes/6.0-compatibility/#feature-compatibility. :: caused by :: Invalid feature compatibility version value '5. │
│ 0'; expected '6.0' or '6.3' or '7.0'
Where would I update this Compatibility version? The pod isn’t running at this point.
Or can I fix the version of MongoDB on the pod to a prior version.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi there,
Based on the output that you’ve shared it seems that MongoDB was upgraded to a newer version without the
featureCompatibilityVersion
being upgraded in stages.When upgrading MongoDB across multiple major versions, it’s recommended to upgrade one major version at a time and update the
featureCompatibilityVersion
in between.Here’s what you can do to recover:
1. Downgrade MongoDB:
First, downgrade your MongoDB to the previous stable version you were using (e.g., 5.0).
As you mentioned that it is a MongoDB pod, I would assume that you are using Kubernetes, you can change the image version in your MongoDB deployment configuration.
For instance:
After making the change, apply the updated configuration:
Once the pod is running with the downgraded version, verify that you can connect to your MongoDB instance.
2. Set the featureCompatibilityVersion:
Connect to your MongoDB instance and set the
featureCompatibilityVersion
:3. Upgrade Step-by-step:
Now, when you’re ready to upgrade:
featureCompatibilityVersion
to “6.0”.featureCompatibilityVersion
to “6.3”.featureCompatibilityVersion
to “7.0”.Always make sure to backup your data before performing any upgrade operations.
Preventing Automatic Upgrades:
To prevent unexpected upgrades in the future, always pin your MongoDB version in your Kubernetes configurations (or whatever method you use to deploy). For instance, instead of using
mongo:latest
as your image, usemongo:5.0
or whatever specific version you intend to use.Let me know how it goes!
Best,
Bobby