I recently updated my mongodb version to 4.4 from 4.2. Seems like it had some breaking changes.
Now the service is not at all running, and showing me this error.
I know downgrading is not an option. But is there a solution to this?
Thanks in advance
You first need to upgrade your database to version 4.2 before using mongodb 4.4.
It is not directly obvious from the official guides related to migration but mongodb do not automatically update the version of a database to match the version of the mongodb program.
Actually it will try to keep compatibility with the version used when creating the database. You need to do one manual operation to tell mongodb to update the format of the database.
Mongodb releases tends to understand format used by the previous version but not older (so mongo 4.4 can use database in versions 4.2 but not earlier).
So the solution is to first start a mongodb instance compatible with the version of the database (4.2 in your case) and use the mongo
client to issue this command:
db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
This will actually ask mongodb to migrate the format of the database to use version 4.2.
Now, you can use the release 4.4 of mongoDB but it will use your database in a compatibility mode with the version 4.2.
You can directly issue the next command to apply the migration right away.
db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
These operations are required for each release of MongoDB. So, if you happen to have a database that is several release behind, you have to manually update it through each and every version of MongoDB.
I got the solution, but it's a hard one.
i deleted everything inside /data/db
were I kept all my mongoose data.
I backed up the data for now, but didn't get a correct solution
You must upgrade MongoDB one release at a time. See https://docs.mongodb.com/manual/release-notes/4.4-upgrade-standalone/ and https://docs.mongodb.com/manual/release-notes/4.2/#upgrade.
Complete the upgrade to 4.2 then upgrade to 4.4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With