is it possible to query .order based on a variable?
I have this query I am returning it by order('desc') but im assuming is desc based on the _creationTime. Is it possible or how would I do it if I what to sort the date variable not the _creationTime variable?
I included the schema and the function
4 Replies
Queries are sorted by an index, and indexes implicitly end in
_creationTime
, so your query is currently sorted descending on _creationTime
. To sort by date instead you could define the index on both fields ["planId","date"]
. Or you could post-sort:
gotcha makes sense thank you!
Incase anyone needs it