@prisma/orm-mongo 8.0.0-rc.14-dev.41 → 8.0.0-rc.14-dev.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-mongo",
3
- "version": "8.0.0-rc.14-dev.41",
3
+ "version": "8.0.0-rc.14-dev.43",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -10,18 +10,18 @@
10
10
  "skills"
11
11
  ],
12
12
  "dependencies": {
13
- "@prisma/orm-family-mongo": "8.0.0-rc.14-dev.41",
14
- "@prisma/orm-framework": "8.0.0-rc.14-dev.41",
15
- "@prisma/orm-target-mongo": "8.0.0-rc.14-dev.41",
16
- "@prisma/orm-toolchain": "8.0.0-rc.14-dev.41",
13
+ "@prisma/orm-family-mongo": "8.0.0-rc.14-dev.43",
14
+ "@prisma/orm-framework": "8.0.0-rc.14-dev.43",
15
+ "@prisma/orm-target-mongo": "8.0.0-rc.14-dev.43",
16
+ "@prisma/orm-toolchain": "8.0.0-rc.14-dev.43",
17
17
  "mongodb-connection-string-url": "^7.0.1",
18
18
  "pathe": "^2.0.3",
19
19
  "tinyglobby": "^0.2.17"
20
20
  },
21
21
  "devDependencies": {
22
- "@internal/mongo": "8.0.0-rc.14-dev.41",
23
- "@repo/tsconfig": "8.0.0-rc.14-dev.41",
24
- "@repo/tsdown": "8.0.0-rc.14-dev.41",
22
+ "@internal/mongo": "8.0.0-rc.14-dev.43",
23
+ "@repo/tsconfig": "8.0.0-rc.14-dev.43",
24
+ "@repo/tsdown": "8.0.0-rc.14-dev.43",
25
25
  "tsdown": "0.22.14",
26
26
  "typescript": "5.9.3"
27
27
  },
@@ -15,7 +15,7 @@ description: >-
15
15
  ORM 7 or earlier (schema.prisma + @prisma/client).
16
16
  metadata:
17
17
  library: '@prisma/orm-mongo'
18
- library_version: '8.0.0-rc.14-dev.41'
18
+ library_version: '8.0.0-rc.14-dev.43'
19
19
  version: '2026-09-12'
20
20
  ---
21
21
 
@@ -19,7 +19,7 @@ Reach for the ORM first; drop to `db.query` when the ORM can't express the shape
19
19
  |---|---|---|
20
20
  | Standard CRUD with reference relations | **ORM (`db.orm.<root>`)** | Collection-shaped; object `.where({ ... })`; `.create` / `.update` / `.delete` / `.upsert`. |
21
21
  | Eager-load a reference relation | **ORM `.include('<relation>')`** | Lowers to `$lookup`; composes with `.where` / `.select` / `.orderBy` / `.limit`. |
22
- | Polymorphic root (discriminated variants) | **ORM `.variant('<VariantName>')`** | Narrows to one variant and injects the discriminator filter. |
22
+ | Polymorphic root (discriminated variants) | **ORM `.variant('<discriminator value>')`** | Narrows to the variant declaring that value and injects the discriminator filter. |
23
23
  | Field-level Mongo updates (`$push`, `$inc`, dot-path `$set`) | **ORM `.update((f) => [f.field.inc(1)])`** | Field-accessor callback; plain-object `.update({ ... })` for whole-field replacement. |
24
24
  | Aggregation pipeline (group, facet, `$lookup` with reshaping) | **Query builder (`db.query.from(...)`)** | Full pipeline surface; typed row shape through `.build()`. |
25
25
  | Typed cross-collection join in a pipeline | **Query builder `.lookup((from) => from('users').on(...).as('author'))`** | `$lookup` with compile-time foreign-root checking. |
@@ -51,11 +51,11 @@ const recent = await db.orm.posts
51
51
 
52
52
  For operators the object form doesn't cover (`.in([...])`, range comparisons, nested logic), pass a `MongoFilterExpr` — today that means importing filter helpers from `@prisma/orm-mongo/query-ast/execution` (a façade-completeness gap; see *What Prisma 8 doesn't do yet* in [`queries.md`](./queries.md)). Prefer the object form whenever equality suffices.
53
53
 
54
- **Polymorphic roots.** When the contract declares variants on a model, narrow before querying:
54
+ **Polymorphic roots.** When the contract declares variants on a model, narrow before querying. `.variant()` takes the discriminator value a variant declares (`"article"` from `@@base(Post, "article")`), not the variant's model name. Call it once, on the base collection; a second `.variant()` on a variant collection is refused:
55
55
 
56
56
  ```typescript
57
- const articles = await db.orm.posts.variant('Article').all();
58
- const tutorials = await db.orm.posts.variant('Tutorial').where({ authorId }).all();
57
+ const articles = await db.orm.posts.variant('article').all();
58
+ const tutorials = await db.orm.posts.variant('tutorial').where({ authorId }).all();
59
59
  ```
60
60
 
61
61
  **Sorting and pagination.** `.orderBy({ field: 1 | -1 })` (Mongo sort directions). `.limit(n)` maps to `$limit`; `.offset(n)` maps to `$skip`.
@@ -161,7 +161,7 @@ The model is the whole row plus its relations, and each related model carries it
161
161
  - `Models.<ns>_<Model>` (from `contract.d.ts`) — every scalar field and every relation. On SQLite, which has no schemas, the name is bare: `Models.User` and `typeof models.User`. On Postgres the schema is part of the name: `Models.public_User`, or `typeof models.public.User` by dotted access — a model declared outside any `namespace { }` block is in `public`, so that is also its name. Mongo names its models the same way. A polymorphic base also emits one member per variant and an `Any<Base>` union (`Models.public_AnyTask`).
162
162
  - `Scalars<M>` — the model without relations; what a default fetch returns. Distributes over unions, so `Scalars<Models.public_AnyTask>` is the union of variant rows.
163
163
  - `Shape<M, Spec>` — a data structure derived from the model, for declaring an endpoint's response type once and having the compiler check the body at the `return`. At every level of `Spec`: `'+'` is a union of scalar and relation names to keep (a relation named there comes with all of its scalars and none of its relations; the scalars are narrowed only when `'+'` names a scalar, so `'+': 'posts'` alone is every scalar plus posts); `'-'` is a union of scalar names to drop; `'+'` naming a scalar beside `'-'` is a compile error, while `{ '-': 'passwordHash'; '+': 'posts' }` is every scalar but the hash plus posts; any other key is a relation whose value is a nested spec that narrows the related model. Relations are absent unless asked for; `X[]`, `X | null`, or `X` comes from the model. Wrong names, a relation in `'-'`, a non-object relation value, and a relation both in `'+'` and as a key are compile errors. No `where`/`orderBy`/`limit`; compose extras with TypeScript (`Shape<M> & { postCount: number }`).
164
- - `ResultType<typeof query>` — the row of any ORM collection value (plain, `.include()`, `.select()`, `.variant()`), and of SQL lane plans. Bind the query to a name first; `typeof` needs a value.
164
+ - `ResultType<typeof query>` — the row of any ORM collection value (plain, `.include()`, `.select()`, `.variant()`), and of SQL lane plans. Bind the query to a name first; `typeof` needs a value. `.variant()` takes the variant's discriminator value, not its model name: `db.orm.public.Task.variant('bug')` for `@@base(Task, "bug")`. Call it once, on the base collection; a second `.variant()` on a variant collection is refused.
165
165
 
166
166
  ```ts
167
167
  import type { models, Models } from './prisma/contract';