code: function getDefaultAuthMechanism(ismaster) {
    if (ismaster) {
      // If ismaster contains saslSupportedMechs, use scram-sha-256
      // if it is available, else scram-sha-1
      if (Array.isArray(ismaster.saslSupportedMechs)) {
        return ismaster.saslSupportedMechs.indexOf('SCRAM-SHA-256') >= 0
          ? 'scram-sha-256'
          : 'scram-sha-1';
      }
  
      // Fallback to legacy selection method. If wire version >= 3, use scram-sha-1
      if (ismaster.maxWireVersion >= 3) {
        return 'scram-sha-1';
      }
    }
  
    // Default for wireprotocol < 3
    return 'mongocr';
  }
docs: Resolves the default auth mechanism according to https://github.com/mongodb/specifications/blob/master/source/auth/auth.rst