Downgrade problem : BadValue: Unrecognized field 'previousVersion'

Hello,

We managed to upgrade a replica set from version 4.4 to version 5.0 but for some application issues reasons, we decided to rollback.

I set setFeatureCompatibilityVersion to 4.4 on the master and tried to rollback to version 4.4 on the secondary node but i got this error when i tried to restart with 4.4 binary.

“ctx”:“initandlisten”,“msg”:“Wrong mongod version”,“attr”:{“error”:“UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: BadValue: Unrecognized field ‘previousVersion’. Contents of featureCompatibilityVersion document in admin.system.version: { _id: "featureCompatibilityVersion", version: "4.4", targetVersion: "4.4", previousVersion: "5.0" }. See https://docs.mongodb.com/master/release-notes/4.4-compatibility/#feature-compatibility.). If the current featureCompatibilityVersion is below 4.2, see the documentation on upgrading at https://docs.mongodb.com/master/release-notes/4.4/#upgrade-procedures.”}}

If i try to change back the setFeatureCompatibilityVersion to 5.0 on the master, i got this error.

“errmsg” : “cannot set featureCompatibilityVersion to ‘5.0’ while featureCompatibilityVersion is ‘downgrading from 5.0 to 4.4’”

So i’m stuck with binary 5.0 and featureCompatibilityVersion in version 4.4.

Fortunately, in this situation, the application started working again but I can’t finish the rollback because of the Unrecognized field ‘previousVersion’ and can’t retry the 5.0 version because the downgrading is still in progress.

Do you have a clean solution to get the cluster in a good state please ?

Thank you in advance,
Best regards.

rs01:PRIMARY> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
{
“featureCompatibilityVersion” : {
“version” : “4.4”,
“targetVersion” : “4.4”,
“previousVersion” : “5.0”
},
“ok” : 1,
“$clusterTime” : {
“clusterTime” : Timestamp(1738160702, 1),
“signature” : {
“hash” : BinData(0,“zk7G4nwdXm9/dcPF7icOanXoMmg=”),
“keyId” : NumberLong(“7426335442213011467”)
}
},
“operationTime” : Timestamp(1738160702, 1)
}

Hello,

I had to use the following commands:

use admin;
db.grantRolesToUser(“adminUser”, [“__system”]);
db.system.version.updateOne({“_id”:“featureCompatibilityVersion”},{$unset:{“targetVersion”:“”,“previousVersion”:“”}})
db.revokeRolesFromUser(“adminUser”, [“__system”]);