1 Reply
This is what i would suggest (btw there's a chatbot at the top of https://docs.convex.dev which can help with questions):
In Convex, you can write a schema with a discriminated union type for documents using
v.union
at the top level. You can separate different types of documents by assigning them distinct kind
values. Here is an example:
In this schema, documents either have a kind
of "StringDocument"
and a string for their value
or they have a kind
of "NumberDocument"
and a number for their value
.