I have a collection of groups and a collection of users, each user document has a collection of ids to the group he has joined. each group id document has one field (timestamp) to mark when a user joined a group. I want to get the list of groups the user has joined in ordered by timestamp descending. First I am getting the groups ids from the sub collection inside user document and they are ordered by timestamp, Then, I am using whereIn() to get the groups objects from the groups top level collection by passing 'groupsIds' ArrayList.
Here is the problem, resulted documents from whereIn() are randomly ordered. I want them to be ordered according to 'groupsIds' list. Can firestore do that for me ? Or I will have to do this myself ?