jstests/multiVersion/genericSetFCVUsage/set_fcv_downgrade_on_disk_changes.js
/**
 * Each new feature that adds downgrade logic to the setFeatureCompatibilityVersion command with
 * {downgradeOnDiskChanges: true} should add their test cases to this test file. Each test case
 * should follow this 'dummyTest' template and implement the following three test functions:
 * this.onDiskChangesBeforeDowngrade: This function will be called before the FCV downgrade to
 * introduce durable on-disk changes that will be downgraded as part the FCV downgrade.
 * this.validateAfterFCVDowngrade: This function will be called after the FCV downgrade to validate
 * the downgrade of the incompatible on-disk changes introduced in onDiskChangesBeforeDowngrade.
 * this.validateAfterBinaryDowngrade: This function will be called after the binary downgrade to
 * 'last-continuous' binaries to validate the downgrade of the incompatible on-disk changes
 * introduced in onDiskChangesBeforeDowngrade.
 *
 * Each new test should also be added to the downgradeOnDiskChangesTests list below.
 */
Each new feature that adds downgrade logic to the setFeatureCompatibilityVersion command with
{downgradeOnDiskChanges: true} should add their test cases to this test file. Each test case
should follow this 'dummyTest' template and implement the following three test functions:
this.onDiskChangesBeforeDowngrade: This function will be called before the FCV downgrade to
introduce durable on-disk changes that will be downgraded as part the FCV downgrade.
this.validateAfterFCVDowngrade: This function will be called after the FCV downgrade to validate
the downgrade of the incompatible on-disk changes introduced in onDiskChangesBeforeDowngrade.
this.validateAfterBinaryDowngrade: This function will be called after the binary downgrade to
'last-continuous' binaries to validate the downgrade of the incompatible on-disk changes
introduced in onDiskChangesBeforeDowngrade.

Each new test should also be added to the downgradeOnDiskChangesTests list below.
Each new feature that adds downgrade logic to the setFeatureCompatibilityVersion command with { downgradeOnDiskChanges : true } should add their test cases to this test file . Each test case should follow this ' dummyTest ' template and implement the following three test functions : this . onDiskChangesBeforeDowngrade : This function will be called before the FCV downgrade to introduce durable on - disk changes that will be downgraded as part the FCV downgrade . this . validateAfterFCVDowngrade : This function will be called after the FCV downgrade to validate the downgrade of the incompatible on - disk changes introduced in onDiskChangesBeforeDowngrade . this . validateAfterBinaryDowngrade : This function will be called after the binary downgrade to ' last - continuous ' binaries to validate the downgrade of the incompatible on - disk changes introduced in onDiskChangesBeforeDowngrade . Each new test should also be added to the downgradeOnDiskChangesTests list below .
function dummyTest() {
    const documents = [{_id: "dummy"}];
    this.onDiskChangesBeforeDowngrade = function(conn) {
        jsTestLog("Running onDiskChangesBeforeDowngrade of dummyTest");
        let testDB = conn.getDB("test");
        assert.commandWorked(testDB.runCommand({insert: "dummy", documents: documents}));
    };
    this.validateAfterFCVDowngrade = function(conn) {
        jsTestLog("Running validateAfterFCVDowngrade of dummyTest");
        let testDB = conn.getDB("test");
        let res = testDB.dummy.find({});
        assert.sameMembers(res.toArray(), documents, () => tojson(res));
    };
    this.validateAfterBinaryDowngrade = function(conn) {
        jsTestLog("Running validateAfterBinaryDowngrade of dummyTest");
        this.validateAfterFCVDowngrade(conn);
    };
}
function dummyTest ( ) { const documents = [ { _id : "dummy" } ] ; this . onDiskChangesBeforeDowngrade = function ( conn ) { jsTestLog ( "Running onDiskChangesBeforeDowngrade of dummyTest" ) ; let testDB = conn . getDB ( "test" ) ; assert . commandWorked ( testDB . runCommand ( { insert : "dummy" , documents : documents } ) ) ; } ; this . validateAfterFCVDowngrade = function ( conn ) { jsTestLog ( "Running validateAfterFCVDowngrade of dummyTest" ) ; let testDB = conn . getDB ( "test" ) ; let res = testDB . dummy . find ( { } ) ; assert . sameMembers ( res . toArray ( ) , documents , ( ) => tojson ( res ) ) ; } ; this . validateAfterBinaryDowngrade = function ( conn ) { jsTestLog ( "Running validateAfterBinaryDowngrade of dummyTest" ) ; this . validateAfterFCVDowngrade ( conn ) ; } ; }
Each new feature that adds downgrade logic to the setFeatureCompatibilityVersion command with
 {downgradeOnDiskChanges: true} should add their test cases to this test file.
Each new feature that adds downgrade logic to the setFeatureCompatibilityVersion command with { downgradeOnDiskChanges : true } should add their test cases to this test file .