{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/964","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/964/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/964/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/964/events","html_url":"https://github.com/Automattic/mongoose/issues/964","id":5097952,"number":964,"title":"pre, post middleware are not executed on findByIdAndUpdate","user":{"login":"skotchio","id":1432812,"avatar_url":"https://avatars.githubusercontent.com/u/1432812?v=3","gravatar_id":"","url":"https://api.github.com/users/skotchio","html_url":"https://github.com/skotchio","followers_url":"https://api.github.com/users/skotchio/followers","following_url":"https://api.github.com/users/skotchio/following{/other_user}","gists_url":"https://api.github.com/users/skotchio/gists{/gist_id}","starred_url":"https://api.github.com/users/skotchio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skotchio/subscriptions","organizations_url":"https://api.github.com/users/skotchio/orgs","repos_url":"https://api.github.com/users/skotchio/repos","events_url":"https://api.github.com/users/skotchio/events{/privacy}","received_events_url":"https://api.github.com/users/skotchio/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Automattic/mongoose/milestones/22","html_url":"https://github.com/Automattic/mongoose/milestones/4.0.0-rc0","labels_url":"https://api.github.com/repos/Automattic/mongoose/milestones/22/labels","id":893197,"number":22,"title":"4.0.0-rc0","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":0,"closed_issues":28,"state":"closed","created_at":"2014-12-05T17:14:46Z","updated_at":"2015-01-30T17:20:53Z","due_on":"2015-01-24T05:00:00Z","closed_at":"2015-01-30T17:20:53Z"},"comments":38,"created_at":"2012-06-15T18:32:26Z","updated_at":"2015-05-04T18:49:18Z","closed_at":"2015-01-21T16:04:55Z","body":"Because a findAndUpdate method is presented to cut down the following code:\n\n     Model.findById(_id, function (err, doc) {\n          if (doc) {\n              doc.field = 'value';\n              doc.save(function (err) {\n                     // do something;\n              });\n          }\n     });\n\nto this:\n\n    Model\n       .findByIdAndUpdate(_id, {$set: {field: 'value'}}, function (err, doc) {\n            // do something \n        });\n\nWe need to use pre, post middleware exactly the same. At now pre, post middleware are not executed when I make findByIdAndUpdate."},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/98811001","html_url":"https://github.com/Automattic/mongoose/issues/964#issuecomment-98811001","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/964","id":98811001,"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-05-04T18:49:18Z","updated_at":"2015-05-04T18:49:18Z","body":"@honitus show me your code"}}