Hi @nicolas-goudry 👋

Thank you for raising this question.

Using an explicit many-to-many relation instead of an implicit one can make the Prisma Client API more complex. However, the advantage of using explicit many-to-many relations is that you can define extra fields on the relation table, which can be useful for storing additional information about the relation.

In your case, you're now connecting Pet to Owner through the OwnersOfPets model, which requires you to specify the petId and ownerId in the connect clause. This is why you can't use the unique name field of Owner to connect to the Pet anymore, because the connection is now being managed through the OwnersOfPets model. While the developer experience (DX) might be different when using explicit many-to-many relations compared to implicit ones, this is the expected behavior and not something you're doing wrong.

If this answers your question, it would be great if you could mark this Discussion as answered to indicate that it has been resolved.

Otherwise please let us know how else we can help you further or close the Discussion if it was resolved in some other way 🙏

🌐
Prisma
prisma.io › home › many-to-many relations › many-to-many relations › many-to-many relations › many-to-many relations › many-to-many relations
Many-to-many relations | Prisma Documentation
Many-to-many (m-n) relations connect zero or more records on one side to zero or more on the other. They can be implicit (Prisma manages the relation table) or explicit (you define the relation table).
🌐
DEV Community
dev.to › tush03 › handle-many-to-many-relations-in-postgresql-using-prisma-orm-11cn
Handle Many to Many Relations in PostgreSQL using Prisma ORM - DEV Community
June 17, 2025 - choosing between implicit and explicit relational handling is depend upon you project requirement. if you require simpler many to many link between two models or don't need extra data on relation itself then you should go with implicit handling. if your project require flexibility in schema , to add more data on relation itself, you should try creating a joining table explicitly to handle many to many relation. Prisma Documentation: https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/many-to-many-relations
Discussions

Relations handling with explicit many to many relation
Hi, I’m using PlanetScale to host my database and Fastify with Prisma to build a simple API. I read the documentation about the things to consider, most notably the missing support of foreign keys. I followed the guide to create indexes on foreign keys and also the guide to create explicit many-... More on github.com
🌐 github.com
1
2
November 6, 2023
typescript - Prisma many-to-many relations: create and connect - Stack Overflow
In my Prisma schema, I have a many-to-many relationship between posts and categories. I've added @map options to match the Postgres snake_case naming convention: model Post { id Int ... More on stackoverflow.com
🌐 stackoverflow.com
database design - Struggling with Prisma schema setup for many-to-many relationships on MongoDB - Stack Overflow
I'm trying to create schemas using PrismaORM with MongoDB, and I'm facing an issue with establishing a many-to-many relationship between User and Post models. My goal is to establish a relation between favorites and favoriteBy fields in these models. More on stackoverflow.com
🌐 stackoverflow.com
mysql - Prisma many to many relation - Stack Overflow
I need to have the TeamHome and TeamAway in Teams but I can't figure out how. At first I was doing optimization using createMany but I can't use createMany and create an array of objects inside so I More on stackoverflow.com
🌐 stackoverflow.com
🌐
Tericcabrel
blog.tericcabrel.com › many-to-many-relationship-prisma
Handle a Many-to-Many relationship with Prisma and Node.js
February 26, 2024 - A many-to-many relationship occurs when entity A can have n relations to entity B, and inversely, entity B can have m relations to entity A. n and m are numbers greater or equal to 1. Handling this relationship in a web application is not ...
Find elsewhere
🌐
Medium
medium.com › yavar › prisma-relations-2ea20c42f616
Prisma relations
August 19, 2022 - No matter which side is backed by a foreign key, the Prisma Client surfaces both the predecessor and successor fields: ... Note that you can also require each user to have a teacher by making the teacher field required. ... Note that for relational databases, this many-to-many-relation is implicit.
🌐
Prisma
prisma.io › home › relations › relations › relations › relations
Relations | Prisma Documentation
For MongoDB, Prisma ORM uses a normalized data model design, which means that documents reference each other by ID in a similar way to relational databases. See the MongoDB section for more details. Many-to-many relations in relational databases can be modelled in two ways:
🌐
Stack Overflow
stackoverflow.com › questions › 74449275 › prisma-many-to-many-relation
postgresql - Prisma Many-to-Many Relation - Stack Overflow
Yes you can directly add data in implicit table as it exists in the database, it's just that it's not surfaced in schema file. I am glad to hear that you were able to solve the issue :) ... What you need here is connect and create. based on prisma documantation you can create query like this.
🌐
GitHub
github.com › prisma › prisma › discussions › 21500
how to do a many-to-many relationship? · prisma/prisma · Discussion #21500
November 21, 2023 - Prisma will handle the creation of the relation table internally. If you need to store additional fields on the relation, such as metadata about the relationship, you would then create an explicit many-to-many relationship by defining a separate model to act as the relation table.
Author   prisma
🌐
StudyRaid
app.studyraid.com › en › read › 11147 › 345639 › many-to-many-relationships
Many-to-Many Relationships - Building and Managing ...
January 1, 2025 - Many-to-many (m-n) relationships in Prisma refer to scenarios where zero or more records on one side of the relation can be connected to zero or more records on the other side. This type of relationship is common in database modeling, such as ...
🌐
Paigeniedringhaus
paigeniedringhaus.com › blog › tips-and-tricks-for-using-the-prisma-orm
Tips and Tricks for Using the Prisma ORM | Paige Niedringhaus
Explicit many-to-many relationships - in explicit m:n relationships, the relation table is represented as its own model in the Prisma schema and can be used in queries.
🌐
GitHub
github.com › prisma › prisma › discussions › 5678
Query Many-to-Many Relationships · prisma/prisma · Discussion #5678
Consider the following example... i have User and Course models, whereas a User can participate in many Courses, and a Course has many Users that participate. i.e., there is a many-to-many association between those 2 relationships. So far so good, i have set up those Prisma models accordingly and migrated to the database.
Author   prisma
🌐
DEV Community
dev.to › frenkix › prisma-orm-update-explicit-many-to-many-relations-1o6f
Prisma ORM update explicit many to many relations - DEV Community
December 27, 2021 - So, when you have explicit many to many relationship, lets say you have post that has multiple tags. And you want to edit that post and pass up new tags or edit/remove existing ones. This is the way to do it: const response: jobs = await prisma.posts.update({ data: { ...data, users: { connect: { id: session.user.id } }, posts_tags: { deleteMany: {}, create: tags.map((tag) => ({ tags: { connect: { id: tag } }, })), }, }, where: { slug: postSlug, }, }); So first you pass up deleteMany: {}, which will delete all connections between post and tags.
🌐
Medium
medium.com › @imvinojanv › mastering-data-relationships-a-comprehensive-guide-to-building-prisma-schemas-99e1fe50a91d
Mastering Data Relationships: A Comprehensive Guide to Building Prisma Schemas | by Vinojan Veerapathirathasan | Medium
May 21, 2024 - Implicit many-to-many relationships are simpler and are used when no additional data needs to be stored in the join table other than the foreign keys. Prisma can abstract the join table, so you don’t have to explicitly define it in your schema.