code: function autorefreshPaths(schemaPath, schemaType, parent) {
  
      //update pathe
      const actualSchemaPath =
        _.compact([(parent || {}).schemaPath, schemaPath]).join('.');
  
      //handle schema
      if (schemaType.schema) {
        schemaType.schema.eachPath(function (_schemaPath, _schemaType) {
          autorefreshPaths(
            _schemaPath, _schemaType,
            ({ schemaPath: schemaPath, schemaType: schemaType })
          );
        });
      }
  
      //ensure schema type has options
      const hasOptions = _.has(schemaType, 'options');
  
      //ensure schema type is objectid `ref`
      const hasRef = _.has(schemaType, 'options.ref');
  
      //check for autorefresh schema options
      const autorefreshable = _.has(schemaType, 'options.autorefresh');
  
      //check if is allowed autorefresh schema type
      const refreshable = hasOptions && hasRef && autorefreshable;
  
      //handle `autorefresh:boolean|object` schema options
      if (refreshable) {
  
        //obtain schema type ref & autorefresh options
        const { ref, autorefresh } = schemaType.options;
  
        //prepare refreshable options
        let options = _.merge({}, { path: actualSchemaPath, ref: ref });
        if (_.isPlainObject(autorefresh)) {
          options = _.merge({}, defaults, options, autorefresh);
        }
  
        //add model exists async validation
        refs[actualSchemaPath] = _.merge({}, options);
  
      }
  
    }
docs: @name autorefresh
  @description iterate though each schema path, check for ObjectId(ref)
  schema fields and apply fresh plugin to a schema type(s) with
  `autorefresh:true` options
  
  @param {String} schemaPath schema path
  @param {SchemaType} schemaType valid mongoose schema type
  @private