zid
zidā€¢12mo ago

.neq?

In the docs I see q.neq(l, r) l !== r is a valid filter operator, but it doesnt seem to be working? Error: [CONVEX Q(user:getThreads)] Uncaught TypeError: q.eq(...).eq(...).neq is not a function
.withIndex(
`by_districtsId_status_userId_${filter}`,
(q) =>
q
.eq("districtsId", districtsId)
.eq("status", "visible")
.neq("userId", userId)
)
.withIndex(
`by_districtsId_status_userId_${filter}`,
(q) =>
q
.eq("districtsId", districtsId)
.eq("status", "visible")
.neq("userId", userId)
)
6 Replies
zid
zidOPā€¢12mo ago
ah, i see now that i was inside the filter section, not withIndex. ah, i guss its not possible..
jamwt
jamwtā€¢12mo ago
on an index, it's basically the "same" as page through everything and just filter. since you're not using the index to "skip" any records
ian
ianā€¢12mo ago
You can do two queries with .lt and .gt in the index. And for things like "undefined" or "null" you can find all values as .gt("maybeExists", null) There's a sort order for all types it turns out, so if your field has strings and objects and numbers, they'll all show up as either .gt or .lte some value (currently). This is either a feature or confusing depending who you ask šŸ˜…
zid
zidOPā€¢12mo ago
haha, i see. thank you for the explanations...i do have a follow up question that's somewhat related... with each successive pagination page we fetch, how are the results of the previous batches mixed together? ā€¢ is it concatenated? as in, pageOneResults.concat(pageTwoResults) ā€¢ or is the entire list "resorted" [...pageOneResults, ...pageTwoResults].sort()
lee
leeā€¢12mo ago
Pagination pages are concatenated, but the results are still in sorted order. Could you give an example where re-sorting might make a difference?
zid
zidOPā€¢12mo ago
Pasting a part of our direct message conversation here i have my own sorting algorithm and want to apply that to the results from the paginated query (the entire combined pages/batches) or be able to incorporate my own algorithm after the withIndex. I made a separate support ticket "Pagination features" related to this

Did you find this page helpful?