Skip afterFind for Aggregate and Distinct Queries (#4596)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user