Trey Holterman
08/26/2022, 2:54 PMmodel Report {
id String @id @default(auto()) @map("_id") @db.ObjectId
...
team Team @relation(fields: [teamId], references: [id])
teamId String
...
}
Here’s the Team:
model Team {
id String @id @map("_id")
...
reports Report[]
...
}
I’ve tried creating a number of different ways. I thought the right way was as such:
const report = await prisma.report.create({
data: {
id : newId.toString(),
teamId: teamId,
...
},
});
Which gives error:
"Parse errors: [Query parsing/validation error at Mutation.createOneReport.data.ReportCreateInput.team: A value is required but not set"
Which I interpret to mean it’s missing the ‘team’ object.
So I tried:
const report = await prisma.report.create({
data: {
id : newId.toString(),
...
teamId: teamId,
team: {
connect: {
id: teamId,
},
},
...
},
});
Which errors out telling me I shouldn’t be including team Id. (will include error in thread). But if I don’t invlude teamId it errors out telling me I should be using teamId.
Very confusing since I used to be able to just add teamId in these types of situationsTrey Holterman
08/26/2022, 2:57 PMA value is required but not set., Query parsing/validation error at `Mutation.createOneReport.data.ReportUncheckedCreateInput.teamId`Trey Holterman
08/26/2022, 2:57 PMUnknown arg `teamId` in data.teamId for type ReportCreateInput. Did you mean `team`?Trey Holterman
08/26/2022, 4:08 PM