mongozen-1
Version:
Type-safe, developer-friendly MongoDB aggregation pipeline builder for TypeScript, with auto-relation support and full IntelliSense. Works great with NestJS, Mongoose, or Node.js apps.
2 lines (1 loc) • 1.1 kB
JavaScript
var t=class{constructor(e){this.relations=e;this.pipeline=[]}match(e){return this.pipeline.push({$match:e}),this}project(e){return this.pipeline.push({$project:e}),this}sort(e){return this.pipeline.push({$sort:e}),this}group(e){return this.pipeline.push({$group:e}),this}limit(e){return this.pipeline.push({$limit:e}),this}skip(e){return this.pipeline.push({$skip:e}),this}count(e){return this.pipeline.push({$count:e}),this}unwind(e){return this.pipeline.push({$unwind:e}),this}addFields(e){return this.pipeline.push({$addFields:e}),this}set(e){return this.pipeline.push({$set:e}),this}unset(e){return this.pipeline.push({$unset:e}),this}replaceRoot(e){return this.pipeline.push({$replaceRoot:e}),this}replaceWith(e){return this.pipeline.push({$replaceWith:e}),this}lookup(e){return this.pipeline.push({$lookup:e}),this}facet(e){return this.pipeline.push({$facet:e}),this}unionWith(e){return this.pipeline.push({$unionWith:e}),this}out(e){return this.pipeline.push({$out:e}),this}merge(e){return this.pipeline.push({$merge:e}),this}build(){return this.pipeline}};export{t as AggregationBuilder};