@prisma/orm-mongo 8.0.0-rc.17 → 8.0.0-rc.17-dev.3
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.17",
|
|
3
|
+
"version": "8.0.0-rc.17-dev.3",
|
|
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.17",
|
|
14
|
-
"@prisma/orm-framework": "8.0.0-rc.17",
|
|
15
|
-
"@prisma/orm-target-mongo": "8.0.0-rc.17",
|
|
16
|
-
"@prisma/orm-toolchain": "8.0.0-rc.17",
|
|
13
|
+
"@prisma/orm-family-mongo": "8.0.0-rc.17-dev.3",
|
|
14
|
+
"@prisma/orm-framework": "8.0.0-rc.17-dev.3",
|
|
15
|
+
"@prisma/orm-target-mongo": "8.0.0-rc.17-dev.3",
|
|
16
|
+
"@prisma/orm-toolchain": "8.0.0-rc.17-dev.3",
|
|
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.17",
|
|
23
|
-
"@repo/tsconfig": "8.0.0-rc.17",
|
|
24
|
-
"@repo/tsdown": "8.0.0-rc.17",
|
|
22
|
+
"@internal/mongo": "8.0.0-rc.17-dev.3",
|
|
23
|
+
"@repo/tsconfig": "8.0.0-rc.17-dev.3",
|
|
24
|
+
"@repo/tsdown": "8.0.0-rc.17-dev.3",
|
|
25
25
|
"tsdown": "0.22.14",
|
|
26
26
|
"typescript": "5.9.3"
|
|
27
27
|
},
|
package/skills/prisma-8/SKILL.md
CHANGED
|
@@ -76,7 +76,7 @@ for await (const user of db.orm.public.User.select('id', 'email').all()) {
|
|
|
76
76
|
}
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
Two single-row shortcuts also exist on the result, in addition to the collection-level `.first()` (which
|
|
79
|
+
Two single-row shortcuts also exist on the result, in addition to the collection-level `.first()` and `.firstOrThrow()` (which issue `LIMIT 1` on Postgres):
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
82
|
const user = await db.orm.public.User.where({ id }).all().first();
|
|
@@ -85,7 +85,7 @@ const required = await db.orm.public.User.where({ id }).all().firstOrThrow();
|
|
|
85
85
|
// ^? Row ← buffers; throws `RUNTIME.NO_ROWS` if empty.
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
For genuine single-row reads, prefer the *collection*-level `.first()` (which
|
|
88
|
+
For genuine single-row reads, prefer the *collection*-level `.first()` or `.firstOrThrow()` (which add `LIMIT 1` to the SQL on Postgres) over `.all().first()` / `.all().firstOrThrow()` (which fetch all rows and discard the rest). Collection-level `.firstOrThrow()` runs the same query as `.first()`, returns the row without `null`, and rejects with `RUNTIME.NO_ROWS` when nothing matches: `await db.orm.public.User.firstOrThrow({ id })` on Postgres, `await db.orm.users.where({ email }).firstOrThrow()` on Mongo (no arguments there). The result-level helpers are for cases where you already need the full result and want the first row without an extra round-trip.
|
|
89
89
|
|
|
90
90
|
**The result is single-consumption.** Each `AsyncIterableResult` instance can be consumed once — by `await`, by `.toArray()`, or by `for await`. Trying to consume it a second time throws **`RUNTIME.ITERATOR_CONSUMED`**. The fix is almost always to store the array in a variable on first consumption and reuse the variable:
|
|
91
91
|
|