I am trying to set a pre hook on findByIdAndUpdate, however it does not seem that hook exists.
The good news is that I added findOneAndUpdate pre hook and that pre hook seems to get called when I make a call to findByIdAndUpdate.
However when I grab the query object in the pre hook it does not have the id:
ModelSchema.pre('findOneAndUpdate', function(next) {
var query = this.getQuery();
...
});
Model.findByIdAndUpdate(id, {something: 'foo'}, function(err, model) {
...
}
In my hook the query object is:
{something: 'foo'}
But I cannot tell what id the original query was looking for.