Upgrade from 3.6 to 4.4, setFeatureCompatibilityVersion give wrong answer

Hi, I am working on a task to automate upgrade an existing mongo 3.6 container based database to mongo 4.4. According to the documentation I need to first upgrade to 4.0, then to 4.2 and only then to 4.4, and In each step I need to run the command:

     setFeatureCompatibilityVersion: <version>

Where “version” indicates the current mongo version.
In each case the container have a binded volume with the mongo data on the host, so we use the same data each time
These are the steps I performed:

  1. Stop the 3.6 container
  2. Start the 4.0 container
  3. Run setFeatureCompatibilityVersion: 4.0
  4. Stop the 4.0 container
  5. Start the 4.2 container
    At this point I get an error:
UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: BadValue: Invalid value for version, found 3.6, expected '4.2' or '4.0'.

This is even even though the setFeatureCompatibilityVersion command returned:
{‘ok’: 1.0}
The only way I can get it to work, is if I put a “sleep” command for 60+ seconds after the setFeatureCompatibilityVersion command (the amount of sleep seems to related to the amount of data in the DB)
I have tried running the command:

        getParameter: 1, 
        featureCompatibilityVersion: 1 

To verify the setFeatureCompatibilityVersion command worked, but it always return the value given by the setFeatureCompatibilityVersion, and the container 4.2 fails nonetheless.
I would appreciate any help :pray:

Best advice? Don’t even do this.

Keep things simple.

Build a 4.4 container, take the indexes and aggregations from the 3.6 container, and upload them into the 4.4 container. Then just export the data via exporting the data as BSON, and import the BSON documents.

Save yourself huge amounts of time, and troubleshooting.

Then when you have the database connected to network and services, and you are satisfied, then you can just delete the old 3.6 container.