{"action":"opened","issue":{"url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1466","repository_url":"https://api.github.com/repos/jenssegers/laravel-mongodb","labels_url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1466/labels{/name}","comments_url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1466/comments","events_url":"https://api.github.com/repos/jenssegers/laravel-mongodb/issues/1466/events","html_url":"https://github.com/jenssegers/laravel-mongodb/issues/1466","id":305495988,"number":1466,"title":"Unable to run aggregate query","user":{"login":"vikashkrjha","id":2944846,"avatar_url":"https://avatars3.githubusercontent.com/u/2944846?v=4","gravatar_id":"","url":"https://api.github.com/users/vikashkrjha","html_url":"https://github.com/vikashkrjha","followers_url":"https://api.github.com/users/vikashkrjha/followers","following_url":"https://api.github.com/users/vikashkrjha/following{/other_user}","gists_url":"https://api.github.com/users/vikashkrjha/gists{/gist_id}","starred_url":"https://api.github.com/users/vikashkrjha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vikashkrjha/subscriptions","organizations_url":"https://api.github.com/users/vikashkrjha/orgs","repos_url":"https://api.github.com/users/vikashkrjha/repos","events_url":"https://api.github.com/users/vikashkrjha/events{/privacy}","received_events_url":"https://api.github.com/users/vikashkrjha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-15T10:36:16Z","updated_at":"2018-03-15T10:36:16Z","closed_at":null,"author_association":"NONE","body":"**Here's the code** \r\nreturn Order::raw(function($Order){\r\n            return $Order->aggregate([\r\n                [\r\n                    '$group'=>[\r\n                        '_id'=>[\r\n                            'source_name'=>'$source_name',\r\n                            'currency'=>'$currency'\r\n                        ],\r\n                        'total_sale_usd'=>['$sum'=>'$total_price_usd'],\r\n                        'total_sale_currency'=>['$sum'=>'$subtotal_price'],\r\n                        'orders_count'=>['$sum'=>1]\r\n                    ]\r\n                ]\r\n            ]);\r\n        });\r\n\r\n\r\n**Output:**\r\n{\r\n    \"error\": \"Method Illuminate\\\\Database\\\\Eloquent\\\\Collection::addEagerConstraints does not exist.\",\r\n    \"file\": \"/Applications/XAMPP/xamppfiles/htdocs/pa-mobile-app/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php\",\r\n    \"line\": 98,\r\n    \"code\": 0\r\n}\r\n\r\n\r\n**Composer.json**\r\n\"php\": \">=7.0.0\",\r\n\"fideloper/proxy\": \"~4.0\",\r\n\"jenssegers/mongodb\": \"^3.4\",\r\n\"laravel/framework\": \">=5.6\",\r\n\"laravel/tinker\": \"~1.0\","}}
{"actor":{"display_login":"vikashkrjha"}}