Hi, im currently making a social media app that have a feature that can display top users ordered by their number of post/s. So in my "Users" collection it already have an attribute of posts which refers to the postId of the post/s they posted. I want to call the users collection and sort it descendingly by its posts total count (which is visible in the appwrite that says 11 items). I also have written a code to call the collection based on posts order descendingly but that doesnt work. Should i have created another attributes which stores an integer for postsCount or is there a way to access attribute 'posts' total items count? What should i change in the code Query.orderDesc()?
Hi π You mensioned your solution doesnt work, what exactly is the issue? Are you getting some error message, or empty list? Or wrong order or values?
its returning error because the query wont even run if i put Query.orderDesc('posts') It returns status 500
i tried console.log() something and it doesnt reach if(!users) throw Error; line
What i actually want to do is query users (in the picture theres only 1 user but later there will be more than 1) based on the attribute 'posts' items count (total result for posts attributes which in the picture says 11) so i can sort them based on their posts posted straight from the query with databases.listDocuments
can i actually do that without creating postCount attribute? or i have to create another attribute for a user to store posts count seperately so i can just orderDesc('postCount')?
Recommended threads
- education plan not activated
Hi I have an edu id 13103046@iubat.edu but when I am trying to claim my plan and trying to logging with github where education student plan active. the appwrite...
- I'm getting an error on the console "j?....
On my self hosted instance version 1.8.1 the console is giving me this error when trying to view the rows for a table I recently created. My application is read...
- 500 simultaneous OAuth logins from the s...
Hi, I'd like to ask about rate limiting around Google OAuth login on Appwrite Cloud. **OVERVIEW** Service type: A PWA (web app) for members of a university clu...