whats wrong with my index??
When I apply the index below, I get the following error:
My query
Here's my schema for reference
forum.js:115 usePaginatedQuery hit error, resetting pagination state: [CONVEX Q(user:getDistrictThreads)] Uncaught Error: InvalidCursor: Tried to run a query starting from a cursor, but it looks like this cursor is from a different query.forum.js:115 usePaginatedQuery hit error, resetting pagination state: [CONVEX Q(user:getDistrictThreads)] Uncaught Error: InvalidCursor: Tried to run a query starting from a cursor, but it looks like this cursor is from a different query.My query
threads = await db
.query("threads")
.withIndex(`by_districtsId_postDate_${filter}`, (q) =>
q.eq("districtsId", districtsId).gte("postDate", timeFrameStart)
)
.order("desc")
.paginate(paginationOpts); threads = await db
.query("threads")
.withIndex(`by_districtsId_postDate_${filter}`, (q) =>
q.eq("districtsId", districtsId).gte("postDate", timeFrameStart)
)
.order("desc")
.paginate(paginationOpts);Here's my schema for reference
threads: defineTable({
districtsId: v.id("districts"),
title: v.string(),
username: v.string(),
userElementalAvatarId: v.id("userElementalAvatars"), // fetch username, avatar
message: v.string(),
commentsCount: v.number(),
imageUrl: v.union(v.string(),v.null()),
postDate: v.string(), // ISO string
lastActiveAt: v.string(), // ISO string
tags: v.optional(v.array(v.string())), // "discussion", "rant", etc
points: v.number(), // sum of all reactions
laughs: v.number(),
hearts: v.number(),
likes: v.number(),
dislikes: v.number(),
upvotes: v.number(),
downvotes: v.number(),
})
.index("by_districtsId_postDate_points", ["districtsId", "postDate", "points"])
.index("by_districtsId_postDate_laughs", ["districtsId", "postDate", "laughs"])
.index("by_districtsId_postDate_hearts", ["districtsId", "postDate", "hearts"])
.index("by_districtsId_postDate_likes", ["districtsId", "postDate", "likes"])
.index("by_districtsId_postDate_dislikes", ["districtsId", "postDate", "dislikes"])
// ... threads: defineTable({
districtsId: v.id("districts"),
title: v.string(),
username: v.string(),
userElementalAvatarId: v.id("userElementalAvatars"), // fetch username, avatar
message: v.string(),
commentsCount: v.number(),
imageUrl: v.union(v.string(),v.null()),
postDate: v.string(), // ISO string
lastActiveAt: v.string(), // ISO string
tags: v.optional(v.array(v.string())), // "discussion", "rant", etc
points: v.number(), // sum of all reactions
laughs: v.number(),
hearts: v.number(),
likes: v.number(),
dislikes: v.number(),
upvotes: v.number(),
downvotes: v.number(),
})
.index("by_districtsId_postDate_points", ["districtsId", "postDate", "points"])
.index("by_districtsId_postDate_laughs", ["districtsId", "postDate", "laughs"])
.index("by_districtsId_postDate_hearts", ["districtsId", "postDate", "hearts"])
.index("by_districtsId_postDate_likes", ["districtsId", "postDate", "likes"])
.index("by_districtsId_postDate_dislikes", ["districtsId", "postDate", "dislikes"])
// ...