jstests/concurrency/fsm_workload_helpers/server_types.js
/**
 * Returns true if the process is a mongos, and false otherwise.
 *
 */
Returns true if the process is a mongos, and false otherwise.
Returns true if the process is a mongos and false otherwise .
function isMongos(db) {
    const res = assert.commandWorked(db.getSession().getClient().adminCommand('ismaster'));
    return 'isdbgrid' === res.msg;
}
function isMongos ( db ) { const res = assert . commandWorked ( db . getSession ( ) . getClient ( ) . adminCommand ( 'ismaster' ) ) ; return 'isdbgrid' === res . msg ; }
Returns true if the process is a mongos, and false otherwise.
Returns true if the process is a mongos and false otherwise .
// Run isMaster directly on the database's session's client to bypass any session machinery.