Taco09
Taco092w ago

Indexing Objects / Arrays

Hey everyone, I’m curious about the benefits that object and array types bring to web applications. In my opinion, one purpose of using these types is to store data in the schema that isn’t directly displayed to users. However, one downside is that you can’t index object or array types.
2 Replies
jamwt
jamwt2w ago
Hey there. you can index any field in an embedded object. the top-level object is no more special than any object inside it the reason you can't index arrays is every other index in convex adds one extra write operation to any document change. what people mean when they say "indexing arrays" implies indexing every element of the array, which can be very tricky in convex, b/c we'd have to like understand the delta of what you added/removed to the array, and it could be surprisingly expensive to get the indexes back "in sync" again after array modifications example of indexing inside an object: https://discord.com/channels/1019350475847499849/1338941081420828765/1338941081420828765
Taco09
Taco09OP2w ago
@jamwt Duly noted with thank you for your sharing.

Did you find this page helpful?