Yvens
Yvens5mo ago

[Convex ents] Getting Multiple docs using compound index in the most efficient way

Hello, How would you get a list of document using ents ?
photos: defineEnt({
clientId: v.id("organization_clients"),
organizationId: v.id("organizations"),
storageId: v.id("_storage"),
is_published_to_instagram: v.boolean(),
})
.field("instagram_id", v.optional(v.string()), { index: true })
.index("by_organization_instagram_id", ["organizationId", "instagram_id"])
.index("by_organization_client", ["organizationId", "clientId"])
photos: defineEnt({
clientId: v.id("organization_clients"),
organizationId: v.id("organizations"),
storageId: v.id("_storage"),
is_published_to_instagram: v.boolean(),
})
.field("instagram_id", v.optional(v.string()), { index: true })
.index("by_organization_instagram_id", ["organizationId", "instagram_id"])
.index("by_organization_client", ["organizationId", "clientId"])
Since this bellow, let you only read a single document with a compound index
const task = await ctx.table("users").get("nameAndRank", "Steve", 10);
const task = await ctx.table("users").get("nameAndRank", "Steve", 10);
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?