i want to create a ranked list of dishes in my neighborhood. so far i can rank the dishes by votes.
// dish document structure
{
dish_id: SOME_ID,
categories: ["Soup", "Noodles"],
votes: [SOME_USER_ID_1, SOME_USER_ID_2, ...]
}
The query
const dishRef = collection(db, 'dishes');
const q = query(
dishRef,
where('categories', 'array-contains', 'soup'),
orderBy('votes', 'desc')
);
now i want to rank them by votes which only include the ones of my friends in order to filter out irrelevant votes. let's say i want do query all soup dishes ordered by votes, where the votes counter only counts the votes of my friends. how do i achieve this in a NoSQL database/ firebase? how do i structure my data?
i have a collection of users and a collection of dishes so far. which kind of additional collections are required?