# mongodb-stage-validator

> Parses and validates MongoDB aggregation pipeline stages.

Latest version **0.3.1** (published 2020-01-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install mongodb-stage-validator
pnpm add mongodb-stage-validator
yarn add mongodb-stage-validator
bun add mongodb-stage-validator
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2020-01-14 |
| First published | 2018-02-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 828.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Anna Herlihy |
| Maintainers | aherlihy, alena.khineika, cilix, dpercy, durran, fredtruman, glowe, imlucas, rueckstiess, satyasinha |

## Links

- npm: https://www.npmjs.com/package/mongodb-stage-validator
- Repository: https://github.com/mongodb-js/stage-validator
- Issues: https://github.com/mongodb-js/stage-validator/issues
- npm.io page: https://npm.io/package/mongodb-stage-validator

## Recent versions

- 0.3.1 (latest) — 2020-01-14
- 0.3.0 — 2020-01-10
- 0.2.1 — 2019-09-20
- 0.2.0 — 2019-08-19
- 0.1.3 — 2019-07-30
- 0.1.2 — 2019-06-12
- 0.1.1 — 2019-05-20
- 0.1.0 — 2019-05-20
- 0.0.12 — 2019-04-23
- 0.0.11 — 2019-04-09
- 0.0.10 — 2019-04-09
- 0.0.9 — 2019-02-25
- 0.0.8 — 2018-12-06
- 0.0.7 — 2018-12-06
- 0.0.6 — 2018-08-16
- … 5 more at https://npm.io/package/mongodb-stage-validator/versions

## README

# stage-validator

[![build status](https://secure.travis-ci.org/mongodb-js/stage-validator.png)](http://travis-ci.org/mongodb-js/stage-validator)

Validates a MongoDB aggregation pipeline stage.

## Usage

The main module exposes two functions: `accepts(stageStr)` and `parse(stageStr)`.

#### `accepts(stageStr)`

The `accepts(stageStr)` function takes a pipeline stage string and returns `true` if the
string is a valid MongoDB pipeline stage, `false` otherwise.

Example:

```javascript
var accepts = require('compass-stage-validator').accepts;
var assert = require('assert');

assert.ok(accepts('{"$limit": 1}'));
assert.ok(accepts('{"match": {"x": 35}}'));

assert.equal(accepts('{"$invalid": "key"}'), false);
```

## Related

- [`mongodb-query-parser`](https://github.com/mongodb-js/query-parser) Validate and parse MongoDB queries and projections
- [`mongodb-language-model`](https://github.com/mongodb-js/mongodb-language-model) Work with rich AST's of MongoDB queries
- [`@mongodb-js/compass-aggregations`](https://github.com/mongodb-js/compass-aggregations) MongoDB Compass UI Plugin for building and debugging aggregation pipelines.

## License

Apache 2.0

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