If I try to directly copy the data/db folder from an old installation of mongodb to the new one I'm getting this error when I try to start mongod,

Found an invalid featureCompatibilityVersion document
(ERROR: BadValue: Invalid value for version, found 3.6, expected '4.2' or '4.0'.
Contents of featureCompatibilityVersion document in admin.system.version:
{ _id: "featureCompatibilityVersion", version: "3.6" }.
See https://docs.mongodb.com/manual/release-notes/4.2-compatibility/#feature compatibility.). 
If the current featureCompatibilityVersion is below 4.0, see the documentation on upgrading at

I think it's because my old cluster is from an old version version of mongodb (2018). How do I import my old databases?


You cannot jump directly to version 4.2... You must do upgrade step by step, increasing version from 3.6 to 4.0 first and then you can upgrade it to 4.2 At every step, you must upgrade featureCompabilityVersion.

| improve this answer | |
  • More specifically, check the MongoDB Release Notes for each major version upgrade. The release notes include Changes Affecting Compatibility as well as Upgrade Procedures for each deployment type (standalone, replica set, or sharded cluster). Setting a deployment's FeatureCompatibilityVersion is the final step of a major version upgrade, but there may be other steps depending on your deployment type and the specific major version upgrade. Also, check for driver compatibility before upgrading your server to a newer major release. – Stennie Jun 22 at 9:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.