mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 18:22:40 +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;
|
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);
|
const Homebrew = mongoose.model('Homebrew', HomebrewSchema);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
Reference in New Issue
Block a user