docs: function(mode, tags, options) {
    // TODO(major): tags MUST be an array of tagsets
    if (tags && !Array.isArray(tags)) {
      console.warn(
        'ReadPreference tags must be an array, this will change in the next major version'
      );
  
      if (typeof tags.maxStalenessSeconds !== 'undefined') {
        // this is likely an options object
        options = tags;
        tags = undefined;
      } else {
        tags = [tags];
      }
    }
  
    this.mode = mode;
    this.tags = tags;
  
    options = options || {};
    if (options.maxStalenessSeconds != null) {
      if (options.maxStalenessSeconds <= 0) {
        throw new TypeError('maxStalenessSeconds must be a positive integer');
      }
  
      this.maxStalenessSeconds = options.maxStalenessSeconds;
  
      // NOTE: The minimum required wire version is 5 for this read preference. If the existing
      //       topology has a lower value then a MongoError will be thrown during server selection.
      this.minWireVersion = 5;
    }
  
    if (this.mode === ReadPreference.PRIMARY || this.mode === true) {
      if (this.tags && Array.isArray(this.tags) && this.tags.length > 0) {
        throw new TypeError('Primary read preference cannot be combined with tags');
      }
  
      if (this.maxStalenessSeconds) {
        throw new TypeError('Primary read preference cannot be combined with maxStalenessSeconds');
      }
    }
  }