Hello. In my app there are products, divided on categories and subcategories. 'categories' is a collection, 'subcategories' is a subcollection of 'categories' where each document is a different subcategory. Now I want to create new collection for products but I'm not sure how to connect them/put in database with right categories and subcategories.
The idea is that when the user clicks on a category it takes them to subcategories of this category and after clicking on a particular subcategory it would take the user to results page with products that match this subcategory. Other part of the idea is when the user is going to type something in the searchbar there are going to popup options of searches for products inside a particular category and its subcategory (based on the product's title), and then it would take the user to the search result page.
It's important to keep in mind that there also are going to be product filters, many many of them, slightly different for each subcategory and if collection 'products' would have too many documents it could cause performance issues.
I'd really appreciate your opinion on how can I bring it to life, thank you.
PS. I'm using firebase