Handling Upserts with Optional System Fields
Not sure if this is the best practice here but didn't appear there's a way of getting the Id field to be optional so it can be passed in for upserts (if it doesn't exist, insert, if it does patch). Not sure if my types are entirely correct but seems to work but happy to hear if anyone else agrees
2 Replies
convex/server
exports WithoutSystemFields
and WithOptionalSystemFields
, I'm not sure if they're actually documented anywhere. but customising the types yourself like what you're doing is fine, if they work for youoh didn't know about WithOptionalSystemFields, good shout out. thanks.