Can I provide "indices" in Convex Query?
So I want to query the 2nd and 3rd table values from a table in Convex. Is there a way to do this?
2 Replies
hi! what do you mean by second and third values? if you want the second and third values by creation time, you can do the query
ctx.db.query(“tableName”).withIndex(“by_creation_time”).order(“asc”).take(3)
@TotallyDark it sounds like you might be referring to using relational queries. if so, yes it's possible, and there are some good articles about that: https://stack.convex.dev/relationship-structures-let-s-talk-about-schemas and https://stack.convex.dev/functional-relationships-helpers
Relationship Structures: Let's Talk About Schemas
In this post we’ll look at some patterns for structuring relationships in the Convex database.
Database Relationship Helpers
Traverse database relationships in a readable, predictable, and debuggable way. Support for one-to-one, one-to-many, and many-to-many via utility func...