studio
studio copied to clipboard
Fix Prisma Studio MongoDB Many-to-Many Relations
Problem
It is currently not possible to create records that have Many-to-Many Relations using Prisma Studio and MongoDB. This means that it is not possible in Prisma Data Platform either.
Suggested solution
It should be possible to create records that have Many-to-Many relations in Prisma Studio and Prisma Data Platform regardless of which database is used.
Additional context
For instance, consider the following schema:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
model Order {
id String @id @default(auto()) @map("_id") @db.ObjectId
products Product[] @relation(fields: [productIds], references: [id])
productIds String[] @db.ObjectId
}
model Product {
id String @id @default(auto()) @map("_id") @db.ObjectId
orders Order[] @relation(fields: [orderIds], references: [id])
orderIds String[] @db.ObjectId
}
Now when we try to create a product record in Prisma Studio, we get the following errors:
Thanks for your feedback! We've added it to our long-term roadmap. In the near future, we're not planning on adding new features to Studio (and Data Browser), but this is on our list now.
+1
I am also unable to create records with many to many relations in mongodb on prisma version 4.12.0
I have same issue as well. Can't add records while using many-to-many relations MongoDB. Any solution to this?
what is the latest news? I think that it still hasn't been fixed, The add record button is disabled and I presumed it is still an issue