docs: function gatherPopulateParams (populate, pointers, model, deepPath) {
    var modelName = model.modelName;
    var paths = model.schema.paths;
    var path = '';
    var options;
    var params;
    var ref;
    var deep = false;
    
    while (deepPath.length) {
      path += (path ? '.' : '')+deepPath.shift();
      options = paths[path] && (
        paths[path].caster && paths[path].caster.options
        || paths[path].options
      );
      if (!options) {
        continue;
      }
  
      params = pointers[path] || (pointers[path] = {});
      ref = options.ref || options.type[0] && options.type[0].ref;
      if (!ref) {
        if (selectPointers(params)) {
          deep = true;
        }
        continue;
      }
  
      if (!params.path) {
        params.path = path;
        params.model = ref;
        params.populate = [];
        params.pointers = {};
        populate.push(params);
      }
      if (gatherPopulateParams(
        params.populate,
        params.pointers,
        model.model(ref),
        deepPath
      )) {
        deep = true;
      }
      if (selectPointers(params)) {
        deep = true;
      }
    }
  
    return deep;
  }