laravel-mongodb
laravel-mongodb copied to clipboard
raw method ignores all condition before calling
- Laravel-mongodb Version: 3.7.3
- PHP Version: 7.4
when im using raw method it ignores all condition that i performed on query builder instance
Steps to reproduce
1. Course::query()->where('price' , 600000)->count() //its 1
-
Course::query()->count() //its 3 -
` Course::query() ->where('price' , 600000) ->raw(function ($collection){ return $collection->aggregate([ [ '$match' => [ 'price' => ['$gte' => 5000] ] ], ]); })->count(); //its 3 `
Expected behaviour
expect to apply all conditions that performed on query
Actual behaviour
whats happening now is that raw method ignores all conditions
i know you might suggest using whereRaw but this is basic example of bug i faced this bug using when i was doing some aggregation stage like lookup and and addfields