Indexing arrays
Not supporting array indexing or filtering is a real pain. Is it a popular opinion or is it just me?
Instead of doing something like:
ctx.db.query('products).withIndex(q => q.inArray('tags', tagId))or
ctx.db.query('products).filter(q => q.inArray(q.field('tags'), tagId))Over-fetching and then removing unwanted data is not possible because I have a lot of data and I must use a paginated query.
So I am forced to create a union table
productXtag and update it for each product insert/update/delete.I have multiple cases where I need many-to-many relation and it becomes to be a real nightmare to manage them all.
Why is it not possible to index an array?
This is the first serious pitfall I encounter with Convex. This aside, Convex has the best DX I ever encountered.
--
Here is another concrete and classical example:
I have a
categories and a products table.--> I need an efficient way to get all paginated products in category
A, including all products in its descendants categories (B, C).