Skip to content

Commit

Permalink
fix(model): merge query hooks from discriminators
Browse files Browse the repository at this point in the history
Fix #5147
  • Loading branch information
vkarpov15 committed Apr 19, 2017
1 parent 115e85d commit b13b09b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/services/model/discriminator.js
Expand Up @@ -82,6 +82,7 @@ module.exports = function discriminator(model, name, schema) {
schema.options._id = _id;
}
schema.options.id = id;
schema.s.hooks = model.schema.s.hooks.merge(schema.s.hooks);

schema.callQueue = baseSchema.callQueue.concat(schema.callQueue.slice(schema._defaultMiddleware.length));
schema._requiredpaths = undefined; // reset just in case Schema#requiredPaths() was called on either schema
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"async": "2.1.4",
"bson": "~1.0.4",
"hooks-fixed": "2.0.0",
"kareem": "1.2.1",
"kareem": "1.4.0",
"mongodb": "2.2.25",
"mpath": "0.2.1",
"mpromise": "0.5.5",
Expand Down

0 comments on commit b13b09b

Please sign in to comment.