Feature Compatibility Version (FCV)
Overview
Feature Compatibility Version (FCV) defines which MongoDB features are enabled.
It’s stored in the admin.system.version collection and defaults to the version the database was first deployed on.
FCV allows a replica set to temporarily operate in compatibility mode with an older MongoDB version, even after upgrading the binary files. This provides the ability to upgrade replica set nodes step by step without requiring downtime.
Note: FCV supports only one previous version. For example, MongoDB 7.0 can have FCV set to "6.0" or "7.0", but not "5.0". Therefore, upgrades must be performed step by step: 6.0 → 7.0, then 7.0 → 8.0, and so on.
For standalone MongoDB instances, FCV does not play a significant role — upgrades are performed directly without considering FCV.
Check and Configure FCV Parameter
Before performing any operations that may affect MongoDB, you must create your database backup.
Without database backup, data recovery may be impossible, and our support team will not be able to assist in case of failure or unexpected interruption.
Backups creation and restoration examples
Checking FCV before upgrading:
- Connect to your replica set using user account with access to
admindatabase:
- shell
mongosh "mongodb://your_admin_user:your_password@node1:27017,node2:27017,node3:27017/?replicaSet=your_replicaset_name"
- Get the current FCV value:
- shell
db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 })
- If FCV value is lower than current MongoDB version, update it to match the version you’re using:
- shell
db.adminCommand({ setFeatureCompatibilityVersion: "7.0" })
Step-by-step upgrade procedure for replica sets
- Stop one
secondarynode, upgrade it to next major MongoDB version, and start it again. - Wait until upgraded node fully synchronizes with your replica set:
- shell
rs.status()
- Repeat the process for the remaining
secondarynodes. - Step down your current
primaryand promote one of the upgradedsecondarynodes toprimary:
- shell
rs.stepDown()
- Make sure your former
primaryhas become asecondary:
- shell
rs.status()
- Upgrade former
primarynode to the target version. - Once all replica set members have been upgraded, raise FCV to the new version.
- shell
db.adminCommand({ setFeatureCompatibilityVersion: "7.0" })