Skip to content

Commit dba7ffd

Browse files
docs: add questions answered section to top 20 pages and guides (#7186)
1 parent b40389e commit dba7ffd

File tree

21 files changed

+189
-0
lines changed

21 files changed

+189
-0
lines changed

content/200-orm/100-prisma-schema/20-data-model/20-relations/100-one-to-one-relations.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ This page introduces one-to-one relations and explains how to use them in your P
1010

1111
</TopBlock>
1212

13+
<details>
14+
<summary>Questions answered in this page</summary>
15+
16+
- How do I model one-to-one relations?
17+
- Which side should store the foreign key?
18+
- How do optional vs required 1-1 work?
19+
20+
</details>
21+
1322
## Overview
1423

1524
One-to-one (1-1) relations refer to relations where at most **one** record can be connected on both sides of the relation. In the example below, there is a one-to-one relation between `User` and `Profile`:

content/200-orm/100-prisma-schema/20-data-model/20-relations/200-one-to-many-relations.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ tocDepth: 3
66

77
This page introduces one-to-many relations and explains how to use them in your Prisma schema.
88

9+
<details>
10+
<summary>Questions answered in this page</summary>
11+
12+
- How do I model one-to-many relations?
13+
- Which side holds the foreign key in 1-n?
14+
- How do optional vs required 1-n work?
15+
16+
</details>
17+
918
## Overview
1019

1120
One-to-many (1-n) relations refer to relations where one record on one side of the relation can be connected to zero or more records on the other side. In the following example, there is one one-to-many relation between the `User` and `Post` models:

content/200-orm/100-prisma-schema/20-data-model/20-relations/300-many-to-many-relations.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ Prisma schema syntax and the implementation in the underlying database differs b
1212

1313
</TopBlock>
1414

15+
<details>
16+
<summary>Questions answered in this page</summary>
17+
18+
- How do I model many-to-many in Prisma?
19+
- When to use implicit vs explicit m-n?
20+
- How do I query m-n relations?
21+
22+
</details>
23+
1524
## Relational databases
1625

1726
In relational databases, m-n-relations are typically modelled via [relation tables](/orm/prisma-schema/data-model/relations/many-to-many-relations#relation-tables). m-n-relations can be either [explicit](#explicit-many-to-many-relations) or [implicit](#implicit-many-to-many-relations) in the Prisma schema. We recommend using [implicit](#implicit-many-to-many-relations) m-n-relations if you do not need to store any additional meta-data in the relation table itself. You can always migrate to an [explicit](#explicit-many-to-many-relations) m-n-relation later if needed.

content/200-orm/100-prisma-schema/20-data-model/20-relations/400-self-relations.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ metaDescription: How to define and work with self-relations in Prisma.
55

66
A relation field can also reference its own model, in this case the relation is called a _self-relation_. Self-relations can be of any cardinality, 1-1, 1-n and m-n.
77

8+
<details>
9+
<summary>Questions answered in this page</summary>
10+
11+
- How do I model self-relations?
12+
- Do self-relations always require @relation?
13+
- How do 1-1 vs 1-n self-relations differ?
14+
15+
</details>
16+
817
Note that self-relations always require the `@relation` attribute.
918

1019
## One-to-one self-relations

content/200-orm/100-prisma-schema/20-data-model/20-relations/410-referential-actions/100-special-rules-for-referential-actions.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ In more complicated data models, finding the cascade paths can get complex. Ther
3838

3939
</TopBlock>
4040

41+
<details>
42+
<summary>Questions answered in this page</summary>
43+
44+
- How do I fix cascade cycles on SQL Server?
45+
- Do MongoDB self-relations require NoAction?
46+
- How do I handle multiple cascade paths?
47+
48+
</details>
49+
4150
## Self-relation (SQL Server and MongoDB)
4251

4352
The following model describes a self-relation where an `Employee` can have a manager and managees, referencing entries of the same model.

content/200-orm/100-prisma-schema/20-data-model/20-relations/410-referential-actions/index.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ If you do not specify a referential action, Prisma ORM [uses a default](#referen
4141

4242
</TopBlock>
4343

44+
<details>
45+
<summary>Questions answered in this page</summary>
46+
47+
- What do referential actions do?
48+
- Which defaults apply if none are set?
49+
- How do actions map to my database?
50+
51+
</details>
52+
4453
<Admonition type="danger">
4554

4655
If you upgrade from a version earlier than 2.26.0:

content/200-orm/100-prisma-schema/20-data-model/20-relations/420-relation-mode.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ metaDescription: 'Manage relations between records with relation modes in Prisma
55
tocDepth: 3
66
---
77

8+
<details>
9+
<summary>Questions answered in this page</summary>
10+
11+
- What is `relationMode` in Prisma?
12+
- When should I use `prisma` vs `foreignKeys`?
13+
- How does relation emulation affect constraints?
14+
15+
</details>
16+
817
In Prisma schema, relations between records are defined with the [`@relation`](/orm/reference/prisma-schema-reference#relation) attribute. For example, in the following schema there is a one-to-many relation between the `User` and `Post` models:
918

1019
```prisma file=schema.prisma highlight=4,5,10;normal showLineNumbers

content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/100-connection-management.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ In most cases, you **do not need to explicitly call these methods**. `PrismaClie
1616

1717
See the [connection management guide](/orm/prisma-client/setup-and-configuration/databases-connections) for information about managing connections for different deployment paradigms (long-running processes and serverless functions).
1818

19+
<details>
20+
<summary>Questions answered in this page</summary>
21+
22+
- When should I call $connect and $disconnect?
23+
- How does Prisma manage connection pools?
24+
- How to handle connections in serverless?
25+
26+
</details>
27+
1928
</TopBlock>
2029

2130
## `$connect()`

content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ The query engine manages a **connection pool** of database connections. The pool
1212

1313
Relational database connectors use Prisma ORM's own connection pool, and the MongoDB connectors uses the [MongoDB driver connection pool](https://github.com/mongodb/specifications/blob/master/source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst).
1414

15+
<details>
16+
<summary>Questions answered in this page</summary>
17+
18+
- How do I size Prisma's connection pool?
19+
- How do I set pool timeouts and limits?
20+
- When should I use PgBouncer with Prisma?
21+
22+
</details>
23+
1524
:::note
1625

1726
As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine).

content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/200-pgbouncer.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ An external connection pooler like PgBouncer holds a connection pool to the data
77

88
Usually, this works transparently, but some connection poolers only support a limited set of functionality. One common feature that external connection poolers do not support are named prepared statements, which Prisma ORM uses. For these cases, Prisma ORM can be configured to behave differently.
99

10+
<details>
11+
<summary>Questions answered in this page</summary>
12+
13+
- How do I configure Prisma with PgBouncer?
14+
- Do I need `pgbouncer=true`, and if so, when?
15+
- How does Prisma Migrate work with PgBouncer?
16+
17+
</details>
18+
1019
:::info
1120

1221
Looking for an easy, infrastructure-free solution? Try [Prisma Accelerate](https://www.prisma.io/accelerate?utm_source=docs&utm_campaign=pgbouncer-help)! It requires little to no setup and works seamlessly with all databases supported by Prisma ORM.

0 commit comments

Comments
 (0)