# @prisma-next/mongo-query-ast

> Typed query AST for MongoDB aggregation pipelines

Latest version **0.16.0** (published 2026-07-21) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @prisma-next/mongo-query-ast
pnpm add @prisma-next/mongo-query-ast
yarn add @prisma-next/mongo-query-ast
bun add @prisma-next/mongo-query-ast
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.16.0 |
| Published | 2026-07-21 |
| First published | 2026-04-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=24 |
| Dependencies | 5 |
| Unpacked size | 308.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 414 |
| Maintainers | sevinf, tylerhogarth, aqrln, wmadden-prisma |

## Links

- npm: https://www.npmjs.com/package/@prisma-next/mongo-query-ast
- Repository: https://github.com/prisma/prisma-next
- Homepage: https://github.com/prisma/prisma-next#readme
- Issues: https://github.com/prisma/prisma-next/issues
- npm.io page: https://npm.io/package/@prisma-next/mongo-query-ast

## Dependencies (5)

- [mongodb](https://npm.io/package/mongodb.md) ^7.4.0
- [@prisma-next/contract](https://npm.io/package/@prisma-next/contract.md) 0.16.0
- [@prisma-next/mongo-value](https://npm.io/package/@prisma-next/mongo-value.md) 0.16.0
- [@prisma-next/mongo-contract](https://npm.io/package/@prisma-next/mongo-contract.md) 0.16.0
- [@prisma-next/framework-components](https://npm.io/package/@prisma-next/framework-components.md) 0.16.0

## Recent versions

- 0.16.0 (latest) — 2026-07-21
- 0.16.0-dev.35 (dev) — 2026-08-24
- 0.16.0-dev.34 — 2026-07-27
- 0.16.0-dev.33 — 2026-07-27
- 0.16.0-dev.32 — 2026-07-27
- 0.16.0-dev.31 — 2026-07-27
- 0.16.0-dev.30 — 2026-07-27
- 0.16.0-dev.29 — 2026-07-27
- 0.16.0-dev.28 — 2026-07-24
- 0.16.0-dev.27 — 2026-07-24
- 0.16.0-dev.26 — 2026-07-24
- 0.16.0-dev.25 — 2026-07-24
- 0.16.0-dev.24 — 2026-07-24
- 0.16.0-dev.23 — 2026-07-24
- 0.16.0-dev.22 — 2026-07-23
- … 527 more at https://npm.io/package/@prisma-next/mongo-query-ast/versions

## README

# @prisma-next/mongo-query-ast

Typed AST for MongoDB filters, pipeline stages, and command variants, plus the unified **query plan** envelope.

## Responsibilities

- **Filter expressions**: Composable typed filter nodes (`MongoFieldFilter`, `MongoAndExpr`, `MongoOrExpr`, `MongoNotExpr`, `MongoExistsExpr`) representing `$match` predicates
- **Pipeline stages**: Typed stage classes (`MongoMatchStage`, `MongoProjectStage`, `MongoSortStage`, `MongoLimitStage`, `MongoSkipStage`, `MongoLookupStage`, `MongoUnwindStage`) that model aggregation pipeline operations
- **Commands**: `AnyMongoCommand` and related command types (reads, writes, aggregates) carried on a plan
- **Query plan**: `MongoQueryPlan<Row>` — a branded typed representation with shape `{ collection, command: AnyMongoCommand, meta: PlanMeta }`
- **Visitors**: `MongoFilterVisitor`, `MongoFilterRewriter`, `MongoStageVisitor` interfaces for traversing and transforming AST nodes

Lowering typed nodes to wire BSON is performed by `@prisma-next/adapter-mongo` via `lower(plan)` on `MongoQueryPlan`, which dispatches on `command.kind` and uses internal helpers for filters and pipelines.

## Dependencies

- **Depends on**:
  - `@prisma-next/contract` (plan metadata types)
  - `@prisma-next/mongo-value` (document types, param resolution)
- **Depended on by**:
  - `@prisma-next/mongo-orm` (compiles ORM queries into `MongoQueryPlan`)
  - `@prisma-next/adapter-mongo` (`lower(plan)` from `MongoQueryPlan` to wire commands)

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