code: function validOptions(options) {
    const _validOptions = validOptionNames.concat(legacyOptionNames);
  
    for (const name in options) {
      if (ignoreOptionNames.indexOf(name) !== -1) {
        continue;
      }
  
      if (_validOptions.indexOf(name) === -1 && options.validateOptions) {
        return new MongoError(`option ${name} is not supported`);
      } else if (_validOptions.indexOf(name) === -1) {
        console.warn(`the options [${name}] is not supported`);
      }
  
      if (legacyOptionNames.indexOf(name) !== -1) {
        console.warn(
          `the server/replset/mongos/db options are deprecated, ` +
            `all their options are supported at the top level of the options object [${validOptionNames}]`
        );
      }
    }
  }
docs: Validate options object