mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
Add aggregate query to HB model
This commit is contained in:
@@ -60,6 +60,12 @@ HomebrewSchema.statics.getByUser = async function(username, allowAccess=false, f
|
||||
return brews;
|
||||
};
|
||||
|
||||
HomebrewSchema.statics.getAggregate = async function(aggregate, options={}){
|
||||
const output = await Homebrew.aggregate(aggregate, options)
|
||||
.catch((error)=>{throw 'Can not get aggregate';});
|
||||
return output;
|
||||
};
|
||||
|
||||
const Homebrew = mongoose.model('Homebrew', HomebrewSchema);
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user