- Laravel-mongodb Version: 5.7
- PHP Version: 8.4
Description:
Message::where('broadcast_id', 3)->groupBy('status')->count();
result to
WARNING Object of class Illuminate\Support\Collection could not be converted to int in vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php on line 3932.
and the return value is always 1.
The reason for that is:
It returns a collection if groupBy exists.
whereas Laravel count function on vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:3932 expects a number.
Description:
Message::where('broadcast_id', 3)->groupBy('status')->count();result to
WARNING Object of class Illuminate\Support\Collection could not be converted to int in vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php on line 3932.
and the return value is always 1.
The reason for that is:
laravel-mongodb/src/Query/Builder.php
Line 610 in 7ae1875
It returns a collection if groupBy exists.
whereas Laravel count function on vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:3932 expects a number.