{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-mongodb/issues/250","repository_url":"https://api.github.com/repos/yiisoft/yii2-mongodb","labels_url":"https://api.github.com/repos/yiisoft/yii2-mongodb/issues/250/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-mongodb/issues/250/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-mongodb/issues/250/events","html_url":"https://github.com/yiisoft/yii2-mongodb/issues/250","id":299053039,"number":250,"title":"query with relation not work  ","user":{"login":"lotos2512","id":7212897,"avatar_url":"https://avatars0.githubusercontent.com/u/7212897?v=4","gravatar_id":"","url":"https://api.github.com/users/lotos2512","html_url":"https://github.com/lotos2512","followers_url":"https://api.github.com/users/lotos2512/followers","following_url":"https://api.github.com/users/lotos2512/following{/other_user}","gists_url":"https://api.github.com/users/lotos2512/gists{/gist_id}","starred_url":"https://api.github.com/users/lotos2512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lotos2512/subscriptions","organizations_url":"https://api.github.com/users/lotos2512/orgs","repos_url":"https://api.github.com/users/lotos2512/repos","events_url":"https://api.github.com/users/lotos2512/events{/privacy}","received_events_url":"https://api.github.com/users/lotos2512/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-21T17:08:29Z","updated_at":"2018-02-21T17:32:49Z","closed_at":"2018-02-21T17:32:49Z","author_association":"NONE","body":"### What steps will reproduce the problem?\r\nThis query with relation must be give me result but is  not working\r\n\r\n\r\n```php\r\n$query->where(['title' => ['$regex' => $this->getSearchQuery()]]);\r\n$query->orWhere(['type' => ['$in' => [\r\nTickerFactory::TYPE_SHARE,\r\nTickerFactory::TYPE_OBLIGATION,\r\n]]])->with(['companyModel' => function ($companyQuery) {\r\n$companyQuery->andWhere(['title' => ['$regex' => $this->getSearchQuery()]]);\r\n}]);\r\n```\r\n\r\n### What's expected?\r\nThis query relation must be give me result of relation companyModel but is  not working. When i do --- \r\n\r\n```php\r\n$query->where(['title' => ['$regex' => $this->getSearchQuery()]]);\r\n$query->orWhere(['type' => ['$in' => [\r\nTickerFactory::TYPE_SHARE,\r\nTickerFactory::TYPE_OBLIGATION,\r\n]]])->with(['companyModel']);\r\n}]);\r\n```\r\nIt is worked \r\n\r\n### Additional info\r\n\r\n| Q                      | A\r\n| ---------------------- | ---\r\n| Yii version            | 2.0.13\r\n| Yii MongoDB version    | 2.6 \r\n| MongoDB server version |   XXX\r\n| PHP version            | 7.2 \r\n| Operating system       | ubunty \r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2-mongodb/issues/comments/367406149","html_url":"https://github.com/yiisoft/yii2-mongodb/issues/250#issuecomment-367406149","issue_url":"https://api.github.com/repos/yiisoft/yii2-mongodb/issues/250","id":367406149,"user":{"login":"samdark","id":47294,"avatar_url":"https://avatars2.githubusercontent.com/u/47294?v=4","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"created_at":"2018-02-21T17:32:49Z","updated_at":"2018-02-21T17:32:49Z","author_association":"OWNER","body":"That means that condition you've specified results in now record found."}}
{"actor":{"display_login":"samdark"}}