{"action":"created","comment":{"url":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/comments/62103233","id":62103233,"diff_hunk":"@@ -105,6 +158,68 @@ public function testIncludesReferenceTo()\n         $this->assertSame($jon, $query->getSingleResult());\n     }\n \n+    public function testIncludesReferenceToWithStoreAsId()\n+    {\n+        $kris = new Person('Kris');\n+        $jon = new Person('Jon');\n+\n+        $this->dm->persist($kris);\n+        $this->dm->persist($jon);\n+        $this->dm->flush();\n+\n+        $jon->friendsSimple[] = $kris;\n+        $this->dm->flush();\n+\n+        $qb = $this->dm->createQueryBuilder(__NAMESPACE__.'\\Person');\n+        $qb->field('friendsSimple')->includesReferenceTo($kris);\n+\n+        $queryArray = $qb->getQueryArray();\n+        $this->assertEquals(array(\n+            'friendsSimple' => array(\n+                '$elemMatch' => new \\MongoId($kris->id)\n+            ),\n+        ), $queryArray);\n+\n+        //$query = $qb->getQuery();\n+\n+        // TODO: Looks like this is not valid:\n+        // MongoException: Cannot run command count(): $elemMatch needs an Object\n+        //$this->assertEquals(1, $query->count());","path":"tests/Doctrine/ODM/MongoDB/Tests/QueryTest.php","position":90,"original_position":90,"commit_id":"71029b66b6ee0b44476e5ba77acba27688a0fce1","original_commit_id":"71029b66b6ee0b44476e5ba77acba27688a0fce1","user":{"login":"coudenysj","id":96260,"avatar_url":"https://avatars.githubusercontent.com/u/96260?v=3","gravatar_id":"","url":"https://api.github.com/users/coudenysj","html_url":"https://github.com/coudenysj","followers_url":"https://api.github.com/users/coudenysj/followers","following_url":"https://api.github.com/users/coudenysj/following{/other_user}","gists_url":"https://api.github.com/users/coudenysj/gists{/gist_id}","starred_url":"https://api.github.com/users/coudenysj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coudenysj/subscriptions","organizations_url":"https://api.github.com/users/coudenysj/orgs","repos_url":"https://api.github.com/users/coudenysj/repos","events_url":"https://api.github.com/users/coudenysj/events{/privacy}","received_events_url":"https://api.github.com/users/coudenysj/received_events","type":"User","site_admin":false},"body":"When running this query, I get ``MongoException: Cannot run command count(): $elemMatch needs an Object``.","created_at":"2016-05-04T19:53:54Z","updated_at":"2016-05-04T19:53:54Z","html_url":"https://github.com/doctrine/mongodb-odm/pull/1349#discussion_r62103233","pull_request_url":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349","_links":{"self":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/comments/62103233"},"html":{"href":"https://github.com/doctrine/mongodb-odm/pull/1349#discussion_r62103233"},"pull_request":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349"}}},"pull_request":{"url":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349","id":56933192,"html_url":"https://github.com/doctrine/mongodb-odm/pull/1349","diff_url":"https://github.com/doctrine/mongodb-odm/pull/1349.diff","patch_url":"https://github.com/doctrine/mongodb-odm/pull/1349.patch","issue_url":"https://api.github.com/repos/doctrine/mongodb-odm/issues/1349","number":1349,"state":"open","locked":false,"title":"storeAs option for references","user":{"login":"coudenysj","id":96260,"avatar_url":"https://avatars.githubusercontent.com/u/96260?v=3","gravatar_id":"","url":"https://api.github.com/users/coudenysj","html_url":"https://github.com/coudenysj","followers_url":"https://api.github.com/users/coudenysj/followers","following_url":"https://api.github.com/users/coudenysj/following{/other_user}","gists_url":"https://api.github.com/users/coudenysj/gists{/gist_id}","starred_url":"https://api.github.com/users/coudenysj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coudenysj/subscriptions","organizations_url":"https://api.github.com/users/coudenysj/orgs","repos_url":"https://api.github.com/users/coudenysj/repos","events_url":"https://api.github.com/users/coudenysj/events{/privacy}","received_events_url":"https://api.github.com/users/coudenysj/received_events","type":"User","site_admin":false},"body":"As discusses in #807, this pull requests starts using a `storeAs` option to support different storage formats:\r\n\r\n* `simple`: $id\r\n* `partial`: $id, $ref\r\n* `full`: $id, $ref, $db\r\n\r\nWith `full` being the default.","created_at":"2016-01-22T19:50:33Z","updated_at":"2016-05-04T19:53:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90e3ac08bc8a0dd69929f23f8db685cd47b46052","assignee":null,"milestone":{"url":"https://api.github.com/repos/doctrine/mongodb-odm/milestones/12","html_url":"https://github.com/doctrine/mongodb-odm/milestones/1.1","labels_url":"https://api.github.com/repos/doctrine/mongodb-odm/milestones/12/labels","id":1386633,"number":12,"title":"1.1","description":"","creator":{"login":"malarzm","id":4947711,"avatar_url":"https://avatars.githubusercontent.com/u/4947711?v=3","gravatar_id":"","url":"https://api.github.com/users/malarzm","html_url":"https://github.com/malarzm","followers_url":"https://api.github.com/users/malarzm/followers","following_url":"https://api.github.com/users/malarzm/following{/other_user}","gists_url":"https://api.github.com/users/malarzm/gists{/gist_id}","starred_url":"https://api.github.com/users/malarzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malarzm/subscriptions","organizations_url":"https://api.github.com/users/malarzm/orgs","repos_url":"https://api.github.com/users/malarzm/repos","events_url":"https://api.github.com/users/malarzm/events{/privacy}","received_events_url":"https://api.github.com/users/malarzm/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":45,"state":"open","created_at":"2015-10-31T10:52:41Z","updated_at":"2016-04-16T10:33:35Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349/commits","review_comments_url":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349/comments","review_comment_url":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/doctrine/mongodb-odm/issues/1349/comments","statuses_url":"https://api.github.com/repos/doctrine/mongodb-odm/statuses/71029b66b6ee0b44476e5ba77acba27688a0fce1","head":{"label":"coudenysj:feature/reference-storeAs","ref":"feature/reference-storeAs","sha":"71029b66b6ee0b44476e5ba77acba27688a0fce1","user":{"login":"coudenysj","id":96260,"avatar_url":"https://avatars.githubusercontent.com/u/96260?v=3","gravatar_id":"","url":"https://api.github.com/users/coudenysj","html_url":"https://github.com/coudenysj","followers_url":"https://api.github.com/users/coudenysj/followers","following_url":"https://api.github.com/users/coudenysj/following{/other_user}","gists_url":"https://api.github.com/users/coudenysj/gists{/gist_id}","starred_url":"https://api.github.com/users/coudenysj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coudenysj/subscriptions","organizations_url":"https://api.github.com/users/coudenysj/orgs","repos_url":"https://api.github.com/users/coudenysj/repos","events_url":"https://api.github.com/users/coudenysj/events{/privacy}","received_events_url":"https://api.github.com/users/coudenysj/received_events","type":"User","site_admin":false},"repo":{"id":39061884,"name":"mongodb-odm","full_name":"coudenysj/mongodb-odm","owner":{"login":"coudenysj","id":96260,"avatar_url":"https://avatars.githubusercontent.com/u/96260?v=3","gravatar_id":"","url":"https://api.github.com/users/coudenysj","html_url":"https://github.com/coudenysj","followers_url":"https://api.github.com/users/coudenysj/followers","following_url":"https://api.github.com/users/coudenysj/following{/other_user}","gists_url":"https://api.github.com/users/coudenysj/gists{/gist_id}","starred_url":"https://api.github.com/users/coudenysj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coudenysj/subscriptions","organizations_url":"https://api.github.com/users/coudenysj/orgs","repos_url":"https://api.github.com/users/coudenysj/repos","events_url":"https://api.github.com/users/coudenysj/events{/privacy}","received_events_url":"https://api.github.com/users/coudenysj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/coudenysj/mongodb-odm","description":"Doctrine MongoDB Object Document Mapper (ODM)","fork":true,"url":"https://api.github.com/repos/coudenysj/mongodb-odm","forks_url":"https://api.github.com/repos/coudenysj/mongodb-odm/forks","keys_url":"https://api.github.com/repos/coudenysj/mongodb-odm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coudenysj/mongodb-odm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coudenysj/mongodb-odm/teams","hooks_url":"https://api.github.com/repos/coudenysj/mongodb-odm/hooks","issue_events_url":"https://api.github.com/repos/coudenysj/mongodb-odm/issues/events{/number}","events_url":"https://api.github.com/repos/coudenysj/mongodb-odm/events","assignees_url":"https://api.github.com/repos/coudenysj/mongodb-odm/assignees{/user}","branches_url":"https://api.github.com/repos/coudenysj/mongodb-odm/branches{/branch}","tags_url":"https://api.github.com/repos/coudenysj/mongodb-odm/tags","blobs_url":"https://api.github.com/repos/coudenysj/mongodb-odm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coudenysj/mongodb-odm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coudenysj/mongodb-odm/git/refs{/sha}","trees_url":"https://api.github.com/repos/coudenysj/mongodb-odm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coudenysj/mongodb-odm/statuses/{sha}","languages_url":"https://api.github.com/repos/coudenysj/mongodb-odm/languages","stargazers_url":"https://api.github.com/repos/coudenysj/mongodb-odm/stargazers","contributors_url":"https://api.github.com/repos/coudenysj/mongodb-odm/contributors","subscribers_url":"https://api.github.com/repos/coudenysj/mongodb-odm/subscribers","subscription_url":"https://api.github.com/repos/coudenysj/mongodb-odm/subscription","commits_url":"https://api.github.com/repos/coudenysj/mongodb-odm/commits{/sha}","git_commits_url":"https://api.github.com/repos/coudenysj/mongodb-odm/git/commits{/sha}","comments_url":"https://api.github.com/repos/coudenysj/mongodb-odm/comments{/number}","issue_comment_url":"https://api.github.com/repos/coudenysj/mongodb-odm/issues/comments{/number}","contents_url":"https://api.github.com/repos/coudenysj/mongodb-odm/contents/{+path}","compare_url":"https://api.github.com/repos/coudenysj/mongodb-odm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coudenysj/mongodb-odm/merges","archive_url":"https://api.github.com/repos/coudenysj/mongodb-odm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coudenysj/mongodb-odm/downloads","issues_url":"https://api.github.com/repos/coudenysj/mongodb-odm/issues{/number}","pulls_url":"https://api.github.com/repos/coudenysj/mongodb-odm/pulls{/number}","milestones_url":"https://api.github.com/repos/coudenysj/mongodb-odm/milestones{/number}","notifications_url":"https://api.github.com/repos/coudenysj/mongodb-odm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coudenysj/mongodb-odm/labels{/name}","releases_url":"https://api.github.com/repos/coudenysj/mongodb-odm/releases{/id}","deployments_url":"https://api.github.com/repos/coudenysj/mongodb-odm/deployments","created_at":"2015-07-14T07:57:29Z","updated_at":"2016-01-22T19:35:20Z","pushed_at":"2016-05-04T19:11:15Z","git_url":"git://github.com/coudenysj/mongodb-odm.git","ssh_url":"git@github.com:coudenysj/mongodb-odm.git","clone_url":"https://github.com/coudenysj/mongodb-odm.git","svn_url":"https://github.com/coudenysj/mongodb-odm","homepage":"http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/","size":7438,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"doctrine:master","ref":"master","sha":"c1e9777d1e083d819a354553522903b3b83a6f39","user":{"login":"doctrine","id":209254,"avatar_url":"https://avatars.githubusercontent.com/u/209254?v=3","gravatar_id":"","url":"https://api.github.com/users/doctrine","html_url":"https://github.com/doctrine","followers_url":"https://api.github.com/users/doctrine/followers","following_url":"https://api.github.com/users/doctrine/following{/other_user}","gists_url":"https://api.github.com/users/doctrine/gists{/gist_id}","starred_url":"https://api.github.com/users/doctrine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doctrine/subscriptions","organizations_url":"https://api.github.com/users/doctrine/orgs","repos_url":"https://api.github.com/users/doctrine/repos","events_url":"https://api.github.com/users/doctrine/events{/privacy}","received_events_url":"https://api.github.com/users/doctrine/received_events","type":"Organization","site_admin":false},"repo":{"id":677781,"name":"mongodb-odm","full_name":"doctrine/mongodb-odm","owner":{"login":"doctrine","id":209254,"avatar_url":"https://avatars.githubusercontent.com/u/209254?v=3","gravatar_id":"","url":"https://api.github.com/users/doctrine","html_url":"https://github.com/doctrine","followers_url":"https://api.github.com/users/doctrine/followers","following_url":"https://api.github.com/users/doctrine/following{/other_user}","gists_url":"https://api.github.com/users/doctrine/gists{/gist_id}","starred_url":"https://api.github.com/users/doctrine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doctrine/subscriptions","organizations_url":"https://api.github.com/users/doctrine/orgs","repos_url":"https://api.github.com/users/doctrine/repos","events_url":"https://api.github.com/users/doctrine/events{/privacy}","received_events_url":"https://api.github.com/users/doctrine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/doctrine/mongodb-odm","description":"Doctrine MongoDB Object Document Mapper (ODM)","fork":false,"url":"https://api.github.com/repos/doctrine/mongodb-odm","forks_url":"https://api.github.com/repos/doctrine/mongodb-odm/forks","keys_url":"https://api.github.com/repos/doctrine/mongodb-odm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doctrine/mongodb-odm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doctrine/mongodb-odm/teams","hooks_url":"https://api.github.com/repos/doctrine/mongodb-odm/hooks","issue_events_url":"https://api.github.com/repos/doctrine/mongodb-odm/issues/events{/number}","events_url":"https://api.github.com/repos/doctrine/mongodb-odm/events","assignees_url":"https://api.github.com/repos/doctrine/mongodb-odm/assignees{/user}","branches_url":"https://api.github.com/repos/doctrine/mongodb-odm/branches{/branch}","tags_url":"https://api.github.com/repos/doctrine/mongodb-odm/tags","blobs_url":"https://api.github.com/repos/doctrine/mongodb-odm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doctrine/mongodb-odm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doctrine/mongodb-odm/git/refs{/sha}","trees_url":"https://api.github.com/repos/doctrine/mongodb-odm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doctrine/mongodb-odm/statuses/{sha}","languages_url":"https://api.github.com/repos/doctrine/mongodb-odm/languages","stargazers_url":"https://api.github.com/repos/doctrine/mongodb-odm/stargazers","contributors_url":"https://api.github.com/repos/doctrine/mongodb-odm/contributors","subscribers_url":"https://api.github.com/repos/doctrine/mongodb-odm/subscribers","subscription_url":"https://api.github.com/repos/doctrine/mongodb-odm/subscription","commits_url":"https://api.github.com/repos/doctrine/mongodb-odm/commits{/sha}","git_commits_url":"https://api.github.com/repos/doctrine/mongodb-odm/git/commits{/sha}","comments_url":"https://api.github.com/repos/doctrine/mongodb-odm/comments{/number}","issue_comment_url":"https://api.github.com/repos/doctrine/mongodb-odm/issues/comments{/number}","contents_url":"https://api.github.com/repos/doctrine/mongodb-odm/contents/{+path}","compare_url":"https://api.github.com/repos/doctrine/mongodb-odm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doctrine/mongodb-odm/merges","archive_url":"https://api.github.com/repos/doctrine/mongodb-odm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doctrine/mongodb-odm/downloads","issues_url":"https://api.github.com/repos/doctrine/mongodb-odm/issues{/number}","pulls_url":"https://api.github.com/repos/doctrine/mongodb-odm/pulls{/number}","milestones_url":"https://api.github.com/repos/doctrine/mongodb-odm/milestones{/number}","notifications_url":"https://api.github.com/repos/doctrine/mongodb-odm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doctrine/mongodb-odm/labels{/name}","releases_url":"https://api.github.com/repos/doctrine/mongodb-odm/releases{/id}","deployments_url":"https://api.github.com/repos/doctrine/mongodb-odm/deployments","created_at":"2010-05-20T20:20:00Z","updated_at":"2016-05-01T13:50:08Z","pushed_at":"2016-05-04T19:11:16Z","git_url":"git://github.com/doctrine/mongodb-odm.git","ssh_url":"git@github.com:doctrine/mongodb-odm.git","clone_url":"https://github.com/doctrine/mongodb-odm.git","svn_url":"https://github.com/doctrine/mongodb-odm","homepage":"http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/","size":9640,"stargazers_count":613,"watchers_count":613,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":356,"mirror_url":null,"open_issues_count":118,"forks":356,"open_issues":118,"watchers":613,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349"},"html":{"href":"https://github.com/doctrine/mongodb-odm/pull/1349"},"issue":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/issues/1349"},"comments":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/issues/1349/comments"},"review_comments":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349/comments"},"review_comment":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/pulls/1349/commits"},"statuses":{"href":"https://api.github.com/repos/doctrine/mongodb-odm/statuses/71029b66b6ee0b44476e5ba77acba27688a0fce1"}}}}