how to make am update request without returning Xata metadata?
The code below calls:
const proj = await xata.db.project.update(id, data);
I would like to remove the metadata that comes from it in order to avoid parsing errors from zod at:
project.parse(proj)
Is that possible? I know we can do this when getting data but not sure how the update transaction does that.
4 Replies
Never mind, I have installed the last version of the SDK and it now works:
Right, an array with column names to be returned can be passed as a parameter to the update call - just like you showed.
I don't think there is a way to exclude the xata metadata though as that is returned by default even when specifying columns to return.
Glad that things worked though. Were you able to handle the response including the xata metadata?
yep the issue ended up not being related to the Xata metadata. It was because client_id was returning only the object with its id inside... and zod was validating id + name.... So, when I got the name back it sorted the issue.
Also, returning is enough to remove xata metadata in the frontend code.
Very nice, thank you for sharing