A type-safe, fluent TypeScript library for constructing MongoDB aggregation pipelines. Version 5.0.1 supports all MongoDB aggregation stages and operators, works with the native MongoDB driver, MongoDB Database Commands, and Mongoose. It provides a modular design with helpers for common operations like pagination and projection, automatic validation of pipeline stages, and full TypeScript generics for typed responses. Compared to raw aggregation pipelines, it improves readability and maintainability while reducing errors.
npm install mongodb-pipeline-builderNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Build a MongoDB aggregation pipeline with Match, Project, Sort, and Limit stages using the fluent builder, then execute it against a collection.
Always call .build() after chaining stages to obtain the array of pipeline stages.
Use $And or $Or for combining multiple conditions, e.g., $Expression($And($Equal(...), $GreaterThan(...))).
Pass an optional string label or omit it entirely: `new PipelineBuilder()`.
Call `.build()` on the PipelineBuilder and pass the resulting array to Model.aggregate(pipeline).
Ensure you call .Match() on the PipelineBuilder object before calling .build().
Update to version 5.0.1 or later, and ensure your bundler/resolver supports package.json exports (Node >=12.7, webpack >=5, etc.).
Use the provided helper like `ProjectOnlyHelper(...)` or a PipelineBuilder instance for .Project().
No dependency data recorded yet.