I have a type "Contract" which includes a "User" which is a relation. I am looking to write a mutation to include the User.
I thought that User just stored the ID so my mutation looked like this:
mutation createContract {
createContract(
data: {
contract_no: "999"
user: "5cb0994e24aa9a0008fde672"
contractItems: {
create: [
{
title: "new contract item"
}
]
}
}
) {
id
contract_no
contractItems {
title
}
}
}
The error includes the phrase "Reason: 'user' Expected 'UserCreateOneInput', found not an object. ", IU think that it should be a fairly simple syntax thing. By the way; contractItems have an @embedded directive on them.
I had not set a connection even though the datamodel has an @relation directive against user. Line 5 should read
user: { connect: {id : "5cbae19924aa9a0008fde67c"} }
Thanks to everyone for commenting.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.