iterateFind
Use for await to iterate over the results of a find method.
This function is useful for iterating over large datasets without loading everything into memory at once. It uses pagination to fetch results in chunks, allowing you to process each item as it is retrieved.
ts
import { iterateFind } from 'feathers-utils/utils';Type declaration
ts
type IterateFindOptions<P extends Params = Params> = {
params?: P
}
/**
* Use `for await` to iterate over the results of a `find` method.
*
* This function is useful for iterating over large datasets without loading everything into memory at once.
* It uses pagination to fetch results in chunks, allowing you to process each item as it is retrieved.
*/
export declare function iterateFind<
Services,
Path extends KeyOf<Services>,
Service extends Services[Path] = Services[Path],
P extends Params = InferFindParams<Service>,
Item = InferFindResultSingle<Service>,
>(
app: Application<Services>,
servicePath: Path,
options?: IterateFindOptions<P>,
): AsyncGenerator<Item, void, unknown>| Argument | Type | Description |
|---|---|---|
| app | Application<Services> | |
| servicePath | Path | |
| options | IterateFindOptions<P> |
