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.59 kB
JavaScript
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var s in e)o(t,s,{get:e[s],enumerable:!0})},u=(t,e,s,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of h(e))!l.call(t,i)&&i!==s&&o(t,i,{get:()=>e[i],enumerable:!(p=n(e,i))||p.enumerable});return t};var d=t=>u(o({},"__esModule",{value:!0}),t);var g={};a(g,{AggregationBuilder:()=>r});module.exports=d(g);var r=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}};0&&(module.exports={AggregationBuilder});