Aggregate.prototype.facet()
Parameters
- facet «Object» options
Returns:
- «Aggregate» this
Combines multiple aggregation pipelines.
Example:
Model.aggregate(...)
.facet({
books: [{ groupBy: '$author' }],
price: [{ $bucketAuto: { groupBy: '$price', buckets: 2 } }]
})
.exec();
// Output: { books: [...], price: [{...}, {...}] }
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .