I'm using a flat database layout with Products that have Users, the database layout looks like this. It's the commonly used 'flat' way of working with Firebase data.
Now I have a route, the user can visit: /products/1, which should load the users for that product
So basically I need to ask Firebase to give me the users details for that product's users. (so for 1 and 2 in my example)
What's the good way to go about this?
products: [
{
id: 1,
name: 'Product One',
users: [
1: true,
2: true
]
}
],
users: [
{
id: 1,
name: Tom
}
]