Skip to content

Commit 5567598

Browse files
authored
Merge branch 'main' into jharrell/add-guides-section
2 parents f75c92e + d3ebd72 commit 5567598

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

content/200-orm/200-prisma-client/300-client-extensions/130-result.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,22 @@ const user = await xprisma.user.findFirstOrThrow({
202202
})
203203
```
204204
In this case, omitting both `password` and `sanitizedPassword` will exclude both from the result as well as prevent the `password` field from being read from the database.
205+
206+
## Limitation
207+
As of now, Prisma Client's result extension component does not support relation fields. This means that you cannot create custom fields or methods based on related models or fields in a relational relationship (e.g., user.posts, post.author). The needs parameter can only reference scalar fields within the same model. Follow [issue #20091 on GitHub](https://github.com/prisma/prisma/issues/20091).
208+
209+
210+
```ts
211+
const prisma = new PrismaClient().$extends({
212+
result: {
213+
user: {
214+
postsCount: {
215+
needs: { posts: true }, // This will not work because posts is a relation field
216+
compute(user) {
217+
return user.posts.length; // Accessing a relation is not allowed
218+
},
219+
},
220+
},
221+
},
222+
})
223+
```

content/500-platform/10-about.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The [Console](https://console.prisma.io/login) enables you to manage and configu
1212

1313
- [Accelerate](/accelerate): Speeds up your queries with a global database cache with scalable connection pooling.
1414
- [Pulse](/pulse): Enables you to build event-driven and real-time applications by letting you stream database change events in a type-safe way.
15+
- [Optimize](/optimize): Provides you recommendations that can help you make your database queries faster.
16+
- [Prisma Postgres](/orm/overview/databases/prisma-postgres): A managed PostgreSQL database that is optimized for Prisma.
1517

1618
## Concepts
1719

docusaurus.config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ const config: Config = {
8080
plugins: [
8181
"docusaurus-plugin-sass",
8282
[path.resolve(__dirname, 'client-plugins', 'posthog-docusaurus'),
83-
{
84-
apiKey: DOCUSAURUS_POST_HOG_KEY,
85-
appUrl: DOCUSAURUS_BASE_URL,
86-
person_profiles: "identified_only",
87-
enableInDevelopment: false
88-
},
83+
{
84+
apiKey: DOCUSAURUS_POST_HOG_KEY,
85+
appUrl: 'https://proxyhog.prisma-data.net', // this is safe to have in version control
86+
person_profiles: 'identified_only',
87+
enableInDevelopment: false
88+
},
8989
],
9090
],
9191
presets: [

0 commit comments

Comments
 (0)