Developers of Laravel application writing raw aggregations, may expect the unaltered result, but the method {{Model::raw(callback) }}method applies transformations to the results.
Developers should know that calling Model::raw() method will return a MongoDB\Collection instance.
It's possible to use conditional return type feature of phpstan to indicate the return type depending on the input parameter.
- MongoDB\Laravel\Eloquent\Builder::raw()
- MongoDB\Laravel\Query\Builder::raw()