Open matthewmueller opened 3 years ago
Can you run the Prisma query manually on your project with a script?
Initially looks like mongoDB queries behave differently than Relational SQL ones which Studio does not expect (and probably also should not have to).
https://user-images.githubusercontent.com/170299/125460614-3f994613-0534-4f27-b7c3-4574537f45a9.mp4
prisma -v
ornpx prisma -v
):Invalid
prisma.post.findMany()
invocation:Attempted to serialize scalar 'null' with incompatible type 'String' for field userId.
Query: prisma.post.findMany({ where: { AND: [ ] }, take: 100, skip: 0, select: { id: true, slug: true, title: true, body: true, comments: true, user: true, userId: true, } })
datasource db { provider = "mongodb" url = env("DATABASE_URL") }
generator client { provider = "prisma-client-js" previewFeatures = ["mongoDb"] }
model Post { id String @id @default(dbgenerated()) @map("_id") @db.ObjectId slug String @unique title String body String comments Comment[] user User @relation(fields: [userId], references: [id]) userId String @db.ObjectId }
// Comments contain a comment string and connect back to the post. // postId must have @db.ObjectId to match up with Post's id type model Comment { id String @id @default(dbgenerated()) @map("_id") @db.ObjectId post Post @relation(fields: [postId], references: [id]) postId String @db.ObjectId comment String }
model User { id String @id @default(dbgenerated()) @map("_id") @db.ObjectId email String @unique name String? posts Post[] }