A lightweight TypeScript-first library (v0.23.2, stable) for declaratively generating MongoDB aggregation pipelines. It provides composable helper functions like project, cond, and gt that reduce boilerplate and improve readability over raw pipeline objects. Compared to writing JSON manually, it offers validation, autocompletion, and integration with Node.js and Mongoose. Released under MIT, with 100% test coverage and weekly updates on npm.
npm install mongodb-pipeline-factoryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Builds an aggregation pipeline using project, cond, and gt to compute discounts based on quantity, then calculates total price.
Replace `if(condition, trueVal, falseVal)` with `cond(condition, trueVal, falseVal)`.
Replace `match(...)` with `filter(...)`.
Use spread operator: `const pipeline = [...project(...), ...group(...)]`
Use `gt('$fieldName', value)` not `gt('fieldName', value)`Replace `addFields(...)` with `add(...)`.
Change to: `import { cond } from 'mongodb-pipeline-factory'`Replace `if` with `cond` in imports and usage.
Ensure the result of factory functions is used directly, not converted to string or JSON manually.
No dependency data recorded yet.