{"action":"opened","number":1,"pull_request":{"url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/1","id":42649667,"html_url":"https://github.com/alexmingoia/mongoose-power-populate/pull/1","diff_url":"https://github.com/alexmingoia/mongoose-power-populate/pull/1.diff","patch_url":"https://github.com/alexmingoia/mongoose-power-populate/pull/1.patch","issue_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/issues/1","number":1,"state":"open","locked":false,"title":"Allow population based on findOne queries","user":{"login":"cannoneyed","id":7818584,"avatar_url":"https://avatars.githubusercontent.com/u/7818584?v=3","gravatar_id":"","url":"https://api.github.com/users/cannoneyed","html_url":"https://github.com/cannoneyed","followers_url":"https://api.github.com/users/cannoneyed/followers","following_url":"https://api.github.com/users/cannoneyed/following{/other_user}","gists_url":"https://api.github.com/users/cannoneyed/gists{/gist_id}","starred_url":"https://api.github.com/users/cannoneyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cannoneyed/subscriptions","organizations_url":"https://api.github.com/users/cannoneyed/orgs","repos_url":"https://api.github.com/users/cannoneyed/repos","events_url":"https://api.github.com/users/cannoneyed/events{/privacy}","received_events_url":"https://api.github.com/users/cannoneyed/received_events","type":"User","site_admin":false},"body":"I'm not 100% sure what's going on in the whole module, but it seems like docs is a singular entity when `findOne` is called. Doing a simple array check before iterating over the docs allows it to populate correctly. Might be overlooking things, I just tried the simplest fix first and it seems to work great so far","created_at":"2015-08-18T00:24:59Z","updated_at":"2015-08-18T00:24:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/1/commits","review_comments_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/1/comments","review_comment_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/issues/1/comments","statuses_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/statuses/9fcceeffe778eeec7c7e2d4a3d985bce7b1fe4d7","head":{"label":"cannoneyed:master","ref":"master","sha":"9fcceeffe778eeec7c7e2d4a3d985bce7b1fe4d7","user":{"login":"cannoneyed","id":7818584,"avatar_url":"https://avatars.githubusercontent.com/u/7818584?v=3","gravatar_id":"","url":"https://api.github.com/users/cannoneyed","html_url":"https://github.com/cannoneyed","followers_url":"https://api.github.com/users/cannoneyed/followers","following_url":"https://api.github.com/users/cannoneyed/following{/other_user}","gists_url":"https://api.github.com/users/cannoneyed/gists{/gist_id}","starred_url":"https://api.github.com/users/cannoneyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cannoneyed/subscriptions","organizations_url":"https://api.github.com/users/cannoneyed/orgs","repos_url":"https://api.github.com/users/cannoneyed/repos","events_url":"https://api.github.com/users/cannoneyed/events{/privacy}","received_events_url":"https://api.github.com/users/cannoneyed/received_events","type":"User","site_admin":false},"repo":{"id":40938871,"name":"mongoose-power-populate","full_name":"cannoneyed/mongoose-power-populate","owner":{"login":"cannoneyed","id":7818584,"avatar_url":"https://avatars.githubusercontent.com/u/7818584?v=3","gravatar_id":"","url":"https://api.github.com/users/cannoneyed","html_url":"https://github.com/cannoneyed","followers_url":"https://api.github.com/users/cannoneyed/followers","following_url":"https://api.github.com/users/cannoneyed/following{/other_user}","gists_url":"https://api.github.com/users/cannoneyed/gists{/gist_id}","starred_url":"https://api.github.com/users/cannoneyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cannoneyed/subscriptions","organizations_url":"https://api.github.com/users/cannoneyed/orgs","repos_url":"https://api.github.com/users/cannoneyed/repos","events_url":"https://api.github.com/users/cannoneyed/events{/privacy}","received_events_url":"https://api.github.com/users/cannoneyed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cannoneyed/mongoose-power-populate","description":"Recursively populate mongoose document references in either direction.","fork":true,"url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate","forks_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/forks","keys_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/teams","hooks_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/hooks","issue_events_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/issues/events{/number}","events_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/events","assignees_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/assignees{/user}","branches_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/branches{/branch}","tags_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/tags","blobs_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/git/refs{/sha}","trees_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/statuses/{sha}","languages_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/languages","stargazers_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/stargazers","contributors_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/contributors","subscribers_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/subscribers","subscription_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/subscription","commits_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/commits{/sha}","git_commits_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/git/commits{/sha}","comments_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/comments{/number}","issue_comment_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/issues/comments{/number}","contents_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/contents/{+path}","compare_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/merges","archive_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/downloads","issues_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/issues{/number}","pulls_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/pulls{/number}","milestones_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/milestones{/number}","notifications_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/labels{/name}","releases_url":"https://api.github.com/repos/cannoneyed/mongoose-power-populate/releases{/id}","created_at":"2015-08-18T00:07:12Z","updated_at":"2015-08-18T00:07:12Z","pushed_at":"2015-08-18T00:22:08Z","git_url":"git://github.com/cannoneyed/mongoose-power-populate.git","ssh_url":"git@github.com:cannoneyed/mongoose-power-populate.git","clone_url":"https://github.com/cannoneyed/mongoose-power-populate.git","svn_url":"https://github.com/cannoneyed/mongoose-power-populate","homepage":null,"size":86,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"alexmingoia:master","ref":"master","sha":"7c9f1d1fc78769e1dcf9c88944ea62963440069a","user":{"login":"alexmingoia","id":1112718,"avatar_url":"https://avatars.githubusercontent.com/u/1112718?v=3","gravatar_id":"","url":"https://api.github.com/users/alexmingoia","html_url":"https://github.com/alexmingoia","followers_url":"https://api.github.com/users/alexmingoia/followers","following_url":"https://api.github.com/users/alexmingoia/following{/other_user}","gists_url":"https://api.github.com/users/alexmingoia/gists{/gist_id}","starred_url":"https://api.github.com/users/alexmingoia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexmingoia/subscriptions","organizations_url":"https://api.github.com/users/alexmingoia/orgs","repos_url":"https://api.github.com/users/alexmingoia/repos","events_url":"https://api.github.com/users/alexmingoia/events{/privacy}","received_events_url":"https://api.github.com/users/alexmingoia/received_events","type":"User","site_admin":false},"repo":{"id":38649736,"name":"mongoose-power-populate","full_name":"alexmingoia/mongoose-power-populate","owner":{"login":"alexmingoia","id":1112718,"avatar_url":"https://avatars.githubusercontent.com/u/1112718?v=3","gravatar_id":"","url":"https://api.github.com/users/alexmingoia","html_url":"https://github.com/alexmingoia","followers_url":"https://api.github.com/users/alexmingoia/followers","following_url":"https://api.github.com/users/alexmingoia/following{/other_user}","gists_url":"https://api.github.com/users/alexmingoia/gists{/gist_id}","starred_url":"https://api.github.com/users/alexmingoia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexmingoia/subscriptions","organizations_url":"https://api.github.com/users/alexmingoia/orgs","repos_url":"https://api.github.com/users/alexmingoia/repos","events_url":"https://api.github.com/users/alexmingoia/events{/privacy}","received_events_url":"https://api.github.com/users/alexmingoia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexmingoia/mongoose-power-populate","description":"Recursively populate mongoose document references in either direction.","fork":false,"url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate","forks_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/forks","keys_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/teams","hooks_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/hooks","issue_events_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/issues/events{/number}","events_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/events","assignees_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/assignees{/user}","branches_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/branches{/branch}","tags_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/tags","blobs_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/statuses/{sha}","languages_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/languages","stargazers_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/stargazers","contributors_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/contributors","subscribers_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/subscribers","subscription_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/subscription","commits_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/contents/{+path}","compare_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/merges","archive_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/downloads","issues_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/issues{/number}","pulls_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls{/number}","milestones_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/milestones{/number}","notifications_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/labels{/name}","releases_url":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/releases{/id}","created_at":"2015-07-06T22:24:45Z","updated_at":"2015-07-25T15:42:18Z","pushed_at":"2015-07-27T20:55:20Z","git_url":"git://github.com/alexmingoia/mongoose-power-populate.git","ssh_url":"git@github.com:alexmingoia/mongoose-power-populate.git","clone_url":"https://github.com/alexmingoia/mongoose-power-populate.git","svn_url":"https://github.com/alexmingoia/mongoose-power-populate","homepage":null,"size":102,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/1"},"html":{"href":"https://github.com/alexmingoia/mongoose-power-populate/pull/1"},"issue":{"href":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/issues/1"},"comments":{"href":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/alexmingoia/mongoose-power-populate/statuses/9fcceeffe778eeec7c7e2d4a3d985bce7b1fe4d7"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":1,"deletions":0,"changed_files":1}}