{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/4105","repository_url":"https://api.github.com/repos/Automattic/mongoose","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/4105/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/4105/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/4105/events","html_url":"https://github.com/Automattic/mongoose/issues/4105","id":151703208,"number":4105,"title":"Exclude elements that can't be populated","user":{"login":"santimacia","id":562380,"avatar_url":"https://avatars.githubusercontent.com/u/562380?v=3","gravatar_id":"","url":"https://api.github.com/users/santimacia","html_url":"https://github.com/santimacia","followers_url":"https://api.github.com/users/santimacia/followers","following_url":"https://api.github.com/users/santimacia/following{/other_user}","gists_url":"https://api.github.com/users/santimacia/gists{/gist_id}","starred_url":"https://api.github.com/users/santimacia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santimacia/subscriptions","organizations_url":"https://api.github.com/users/santimacia/orgs","repos_url":"https://api.github.com/users/santimacia/repos","events_url":"https://api.github.com/users/santimacia/events{/privacy}","received_events_url":"https://api.github.com/users/santimacia/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-28T17:48:11Z","updated_at":"2016-05-09T15:18:34Z","closed_at":"2016-05-09T13:41:47Z","body":"Sometimes and objectId can't be populated cause it's missing in the other collection. It's possible to avoid these kind of elements, for example in a find query."},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/217895160","html_url":"https://github.com/Automattic/mongoose/issues/4105#issuecomment-217895160","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/4105","id":217895160,"user":{"login":"Jeff-Lewis","id":676289,"avatar_url":"https://avatars.githubusercontent.com/u/676289?v=3","gravatar_id":"","url":"https://api.github.com/users/Jeff-Lewis","html_url":"https://github.com/Jeff-Lewis","followers_url":"https://api.github.com/users/Jeff-Lewis/followers","following_url":"https://api.github.com/users/Jeff-Lewis/following{/other_user}","gists_url":"https://api.github.com/users/Jeff-Lewis/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeff-Lewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeff-Lewis/subscriptions","organizations_url":"https://api.github.com/users/Jeff-Lewis/orgs","repos_url":"https://api.github.com/users/Jeff-Lewis/repos","events_url":"https://api.github.com/users/Jeff-Lewis/events{/privacy}","received_events_url":"https://api.github.com/users/Jeff-Lewis/received_events","type":"User","site_admin":false},"created_at":"2016-05-09T15:18:34Z","updated_at":"2016-05-09T15:18:34Z","body":"@santimacia I struggle with this \"set null if not found\" when populating as well. See https://github.com/Automattic/mongoose/issues/3937\r\n\r\nYou can get the original ID from `Story.populated('_created')' after it's been populated. The nasty part of this is that you have to add null checks with an additional checks for doc.populated(path) value all over your code."}}