# mongo-pipeline

> A simple way of create aggregations of mongodb

Latest version **1.0.11** (published 2020-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongo-pipeline
pnpm add mongo-pipeline
yarn add mongo-pipeline
bun add mongo-pipeline
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2020-06-26 |
| First published | 2020-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniel A. R. Farina |
| Maintainers | danielfarina |
| Keywords | mongo, aggregate |

## Links

- npm: https://www.npmjs.com/package/mongo-pipeline
- Homepage: https://github.com/danielbom/mongo-aggregation-pipeline#readme
- Issues: https://github.com/danielbom/mongo-aggregation-pipeline/issues
- npm.io page: https://npm.io/package/mongo-pipeline

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 1.0.11 (latest) — 2020-06-26
- 1.0.10 — 2020-06-09
- 1.0.9 — 2020-05-02
- 1.0.8 — 2020-05-02
- 1.0.7 — 2020-05-02
- 1.0.6 — 2020-05-02
- 1.0.5 — 2020-05-02
- 1.0.4 — 2020-04-23
- 1.0.3 — 2020-04-23
- 1.0.2 — 2020-04-23
- 1.0.1 — 2020-04-23
- 1.0.0 — 2020-04-23

## README

# Mongo aggregation pipeline

This module provide a nice way to work with aggregations of mongodb using,
for example, the mongoose in nodejs.

## Basic example

```javascript
const mongoose = require('mongoose');
const { PipelineBuilder } = require('mongo-pipeline');

const pipeline = new PipelineBuilder();

const collection = await pipeline
  .match({ _id: mongoose.Types.ObjectID('xxxxxxxxxxxxxxxxxxx') })
  .lookupAndUnwind('collections', 'field', '_id', 'new')
  .log()
  .aggregateOneWith(mongoose.model('Collection'));
/*
[
  {
    $match: {
      _id: 'xxxxxxxxxxxxxxxxxxx'
    }
  },
  {
    "$lookup": {
      "from": "collections",
      "localField": "field",
      "foreignField": "_id",
      "as": "new"
    }
  },
  {
    "$unwind": {
      "path": "$new"
    }
  }
]
*/
```

See others examples in [test repository](https://github.com/danielbom/mongo-aggregation-pipeline-test).

---
_Source: https://npm.io/package/mongo-pipeline · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
