StreamModel
Interface for models that provide document streaming.
This interface defines a method to retrieve documents from a model as a generator, allowing efficient iteration over large datasets without loading all documents into memory at once.
Tags
Table of Contents
Methods
- stream() : Generator<string|int, mixed>
- Streams documents from the model.
Methods
stream()
Streams documents from the model.
public
stream([array<string|int, mixed> $init = [] ]) : Generator<string|int, mixed>
This method returns a generator that yields each document one at a time. It is useful for iterating over large collections efficiently.
Parameters
- $init : array<string|int, mixed> = []
-
Optional configuration array.
Return values
Generator<string|int, mixed> —Yields each document in the collection. The type of document depends on the model implementation.