I need best practice tips to improve the performance of my noSQL database (hosted on Firebase). Moreover, I need advice on how to structure nodes.
The database stores product information with three main properties:
$productId /date /category /subcategory
On my website, I have three views:
- get the last 4 products (order date)
- get the last 4 products (by date) of category X
- get the last 4 products (by date) of category X and subcategory Y.
Note that I also have node product_images, which have trays matching productIDs. So, let's build the databases as follows:
$categoryId $subCategoryId $productId
will not work, since I need to know $ categoryId and $ subCatrgoryId in advance before I can match it with $ productId. It will also make it difficult to get the last 4 products.
How could I effectively create my noSQL database and how can I get products with Firebase by filtering them with a few restrictions?
I know that in Firebase you can use orderByChild and equalTo, but this only works on one restriction, while I have to deal with one or three.
source share