{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/3173","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/3173/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/3173/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/3173/events","html_url":"https://github.com/Automattic/mongoose/issues/3173","id":95598150,"number":3173,"title":"findOneAndUpdate doesn't return the result object, only the value that was found","user":{"login":"perrin4869","id":5774716,"avatar_url":"https://avatars.githubusercontent.com/u/5774716?v=3","gravatar_id":"","url":"https://api.github.com/users/perrin4869","html_url":"https://github.com/perrin4869","followers_url":"https://api.github.com/users/perrin4869/followers","following_url":"https://api.github.com/users/perrin4869/following{/other_user}","gists_url":"https://api.github.com/users/perrin4869/gists{/gist_id}","starred_url":"https://api.github.com/users/perrin4869/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perrin4869/subscriptions","organizations_url":"https://api.github.com/users/perrin4869/orgs","repos_url":"https://api.github.com/users/perrin4869/repos","events_url":"https://api.github.com/users/perrin4869/events{/privacy}","received_events_url":"https://api.github.com/users/perrin4869/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Automattic/mongoose/milestones/28","html_url":"https://github.com/Automattic/mongoose/milestones/4.1","labels_url":"https://api.github.com/repos/Automattic/mongoose/milestones/28/labels","id":983360,"number":28,"title":"4.1","description":"","creator":{"login":"vkarpov15","id":1620265,"avatar_url":"https://avatars.githubusercontent.com/u/1620265?v=3","gravatar_id":"","url":"https://api.github.com/users/vkarpov15","html_url":"https://github.com/vkarpov15","followers_url":"https://api.github.com/users/vkarpov15/followers","following_url":"https://api.github.com/users/vkarpov15/following{/other_user}","gists_url":"https://api.github.com/users/vkarpov15/gists{/gist_id}","starred_url":"https://api.github.com/users/vkarpov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkarpov15/subscriptions","organizations_url":"https://api.github.com/users/vkarpov15/orgs","repos_url":"https://api.github.com/users/vkarpov15/repos","events_url":"https://api.github.com/users/vkarpov15/events{/privacy}","received_events_url":"https://api.github.com/users/vkarpov15/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":1,"state":"open","created_at":"2015-02-17T18:34:07Z","updated_at":"2015-07-18T17:33:18Z","due_on":"2015-07-24T04:00:00Z","closed_at":null},"comments":5,"created_at":"2015-07-17T06:38:12Z","updated_at":"2015-07-20T15:23:09Z","closed_at":null,"body":"The callback function to `findOneAndUpdate` is passing an error and the `res.val` object, which contains the result of the `findOne` operation.. however, the rest of the `res` object is discarded. I would like to have access to it however... \r\n\r\nThe line in question\r\nhttps://github.com/Automattic/mongoose/blob/master/lib/query.js#L1746\r\n\r\nI think a good solution might be to pass the rest of the `res` object as a third argument, that would not break other people's programs... although ideally, I'd pass either the whole res object, or pass the `res` object as a second argument and `res.val` as a third argument."},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/122916894","html_url":"https://github.com/Automattic/mongoose/issues/3173#issuecomment-122916894","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/3173","id":122916894,"user":{"login":"vkarpov15","id":1620265,"avatar_url":"https://avatars.githubusercontent.com/u/1620265?v=3","gravatar_id":"","url":"https://api.github.com/users/vkarpov15","html_url":"https://github.com/vkarpov15","followers_url":"https://api.github.com/users/vkarpov15/followers","following_url":"https://api.github.com/users/vkarpov15/following{/other_user}","gists_url":"https://api.github.com/users/vkarpov15/gists{/gist_id}","starred_url":"https://api.github.com/users/vkarpov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkarpov15/subscriptions","organizations_url":"https://api.github.com/users/vkarpov15/orgs","repos_url":"https://api.github.com/users/vkarpov15/repos","events_url":"https://api.github.com/users/vkarpov15/events{/privacy}","received_events_url":"https://api.github.com/users/vkarpov15/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T15:23:09Z","updated_at":"2015-07-20T15:23:09Z","body":"Passing it as a third callback parameter would be easiest IMO. Can't really think of another solution without backwards-breaking changes, but that would make it impossible to access that parameter using conventional promise APIs."}}