Programmatically determine which field to update in a Prisma mutation
I want to update a specific field in my database. I'm passing the id of the record to update, the name of the field and the new value for this field, into my router to the chgField procedure. Can this be done with some syntax like that shown in * input.field: input.nu * below , if so, help on the syntax here would be great (this doesn't work).
I sense it might not be possible this way!
4 Replies
Just send the data and use that? 😕
I only have the new data for one field within the record. So I need to tell the update which field to apply the new data to. (I hope that makes sense) i.e. I don't have the entire tuple. e.g. I want the change FirstName within a User record to "bill".
So
input.data
= {"FirstName": "bill"}
?
It's literally the same as what you are doing
But if you really want it that way then do
@Amos, thanks, now have that working. (I'm new to JS and that was the root problem.)