jstests/replsets/libs/tenant_migration_util.js
/**
     * Runs the donorStartMigration command with the given migration options
     * until the migration commits or aborts, or until the command fails. Returns the last command
     * response.
     *
     * If 'retryOnRetryableErrors' is set, this function will retry if the command fails with a
     * retryable error.
     *
     * Only use when it is necessary to run the donorStartMigration command in its own thread. For
     * all other use cases, please consider the runMigration() function in the TenantMigrationTest
     * fixture.
     */
Runs the donorStartMigration command with the given migration options
until the migration commits or aborts, or until the command fails. Returns the last command
response.

If 'retryOnRetryableErrors' is set, this function will retry if the command fails with a
retryable error.

Only use when it is necessary to run the donorStartMigration command in its own thread. For
all other use cases, please consider the runMigration() function in the TenantMigrationTest
fixture.
Runs the donorStartMigration command with the given migration options until the migration commits or aborts or until the command fails . Returns the last command response . If ' retryOnRetryableErrors ' is set this function will retry if the command fails with a retryable error . Only use when it is necessary to run the donorStartMigration command in its own thread . For all other use cases please consider the runMigration () function in the TenantMigrationTest fixture .
function runMigrationAsync(migrationOpts, donorRstArgs, opts = {}) {
        const {
            retryOnRetryableErrors = false,
            enableDonorStartMigrationFsync = false,
        } = opts;
        load("jstests/replsets/libs/tenant_migration_util.js");
        const donorRst = TenantMigrationUtil.createRst(donorRstArgs, retryOnRetryableErrors);
        const migrationCertificates = TenantMigrationUtil.makeMigrationCertificatesForTest();
        const cmdObj = {
            donorStartMigration: 1,
            migrationId: UUID(migrationOpts.migrationIdString),
            recipientConnectionString: migrationOpts.recipientConnString,
            tenantId: migrationOpts.tenantId,
            readPreference: migrationOpts.readPreference || {mode: "primary"},
            donorCertificateForRecipient: migrationOpts.donorCertificateForRecipient ||
                migrationCertificates.donorCertificateForRecipient,
            recipientCertificateForDonor: migrationOpts.recipientCertificateForDonor ||
                migrationCertificates.recipientCertificateForDonor
        };
        return TenantMigrationUtil.runTenantMigrationCommand(cmdObj, donorRst, {
            retryOnRetryableErrors,
            enableDonorStartMigrationFsync,
            shouldStopFunc: TenantMigrationUtil.isMigrationCompleted
        });
    }
function runMigrationAsync ( migrationOpts , donorRstArgs , opts = { } ) { const { retryOnRetryableErrors = false , enableDonorStartMigrationFsync = false , } = opts ; load ( "jstests/replsets/libs/tenant_migration_util.js" ) ; const donorRst = TenantMigrationUtil . createRst ( donorRstArgs , retryOnRetryableErrors ) ; const migrationCertificates = TenantMigrationUtil . makeMigrationCertificatesForTest ( ) ; const cmdObj = { donorStartMigration : 1 , migrationId : UUID ( migrationOpts . migrationIdString ) , recipientConnectionString : migrationOpts . recipientConnString , tenantId : migrationOpts . tenantId , readPreference : migrationOpts . readPreference || { mode : "primary" } , donorCertificateForRecipient : migrationOpts . donorCertificateForRecipient || migrationCertificates . donorCertificateForRecipient , recipientCertificateForDonor : migrationOpts . recipientCertificateForDonor || migrationCertificates . recipientCertificateForDonor } ; return TenantMigrationUtil . runTenantMigrationCommand ( cmdObj , donorRst , { retryOnRetryableErrors , enableDonorStartMigrationFsync , shouldStopFunc : TenantMigrationUtil . isMigrationCompleted } ) ; }
Runs the donorStartMigration command with the given migration options
 until the migration commits or aborts, or until the command fails.
Runs the donorStartMigration command with the given migration options until the migration commits or aborts or until the command fails .