Hey. We have a table called contents, which is:
export const ContentStatus = v.union(
v.literal("Available"),
v.literal("Inbound")
);
export const contentSchema = {
tenantId: v.id("tenants"),
assetId: v.id("assets"),
serialNumber: v.optional(v.string()),
ownerId: v.optional(v.union(v.id("partners"), v.null())),
quantity: v.number(),
location: v.union(
v.object({ type: v.literal("location"), id: v.id("locations") }), // inside a location
v.object({ type: v.literal("content"), id: v.id("contents") }), // inside another content
),
ultimateLocationId: v.id("locations"), // the ultimate location
status: ContentStatus,
};
This table will have 100k-500k rows. We want to be able to do queries by multiple filters. For example based on ownerId and ultimateLocation and status. But the same in all the combinations, like Available or Inbound at ultimateLocation.
Is this possible while staying within convex limits? We know about convex-helpers, streams, aggregates and so. Maybe with aggregates can we pre-calculate stuff or how should we attack this problem?