Skip afterFind for Aggregate and Distinct Queries (#4596)

This commit is contained in:
Diamond Lewis
2018-02-28 19:32:01 -06:00
committed by GitHub
parent 213801c4b1
commit d8f3fb16bd
2 changed files with 46 additions and 0 deletions

View File

@@ -584,6 +584,10 @@ RestQuery.prototype.runAfterFindTrigger = function() {
if (!hasAfterFindHook) {
return Promise.resolve();
}
// Skip Aggregate and Distinct Queries
if (this.findOptions.pipeline || this.findOptions.distinct) {
return Promise.resolve();
}
// Run afterFind trigger and set the new results
return triggers.maybeRunAfterFindTrigger(triggers.Types.afterFind, this.auth, this.className,this.response.results, this.config).then((results) => {
this.response.results = results;