Implement datamodel parser validations for two-way embedded many-to-many relations on MongoDB #11553
Labels
kind/feature
A request for a new feature.
team/schema
Issue for team Schema.
topic: m:n
many-to-many relations
topic: mongodb
Milestone
We want to enable relations looking like this:
This is a type of many-to-many relations with the following rules:
@relation
attributes on both sides have bothfields:
andreferences:
as required arguments.references:
argument must reference a single-field ID on the opposite model. No multi-field ids, no referencing unique criteria other than a single field id.This will be the only type of many-to-many relations allowed on mongodb. In other words, implicit many-to-many relations without
fields: [...]
with scalar backing fields are not valid. This should be validated.More importantly,
Internal design documentation: https://www.notion.so/prismaio/MongoDB-Linking-Referencing-Relations-98b51496ac3f48398e1f0571d13ef790#0708e8c45648492a963ccde0f7d6f1bb
Implementation notes
fields
andreferences
arguments being accepted on implicit m:n relations (all connectors) [PSL] Do not allowreferences
arg on Many2Many relations on SQL #11241references
.references
can only reference a single-field id.fields
should not be automatically addedfields
references
on these relations as a first prisma-fmt-wasm driven code action.This is purely datamodel work, nothing to do in introspection and migration engines.
The text was updated successfully, but these errors were encountered: