{"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":null,"comments":62,"created_at":"2012-06-15T18:32:26Z","updated_at":"2015-06-30T08:28:16Z","closed_at":"2015-05-07T20:38:48Z","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/117053444","html_url":"https://github.com/Automattic/mongoose/issues/964#issuecomment-117053444","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/964","id":117053444,"user":{"login":"agjs","id":7226555,"avatar_url":"https://avatars.githubusercontent.com/u/7226555?v=3","gravatar_id":"","url":"https://api.github.com/users/agjs","html_url":"https://github.com/agjs","followers_url":"https://api.github.com/users/agjs/followers","following_url":"https://api.github.com/users/agjs/following{/other_user}","gists_url":"https://api.github.com/users/agjs/gists{/gist_id}","starred_url":"https://api.github.com/users/agjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agjs/subscriptions","organizations_url":"https://api.github.com/users/agjs/orgs","repos_url":"https://api.github.com/users/agjs/repos","events_url":"https://api.github.com/users/agjs/events{/privacy}","received_events_url":"https://api.github.com/users/agjs/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T08:28:16Z","updated_at":"2015-06-30T08:28:16Z","body":"Also, its not only pre-hook but validation gets ignored completely as well. "}}