#466

Covering indexes for field projections

Requested

Submitted November 20, 2026

Let Convex queries return selected fields directly from an index. A candidate list could read names and parties without loading full biographies or splitting the data across tables.

// Schema .index("by_state_office", { fields: ["state", "office"], include: ["name", "party"], })

// Query const candidates = await ctx.db .query("candidates") .withIndex("by_state_office", q => q.eq("state", "TX").eq("office", "Mayor") ) .select(["_id", "name", "party"]) .take(50);

.select() defines the typed result. include stores extra fields in the index without changing sort order. The first release could require the index to cover every selected or filtered field and keep today’s reactive invalidation. The same .select() API could support arbitrary projections later.

Development Updates

No updates yet