Closed tylerthedeveloper closed 6 years ago
In most document-based databases (which is what I assume firebase is -- if not, you'll want to switch), you can index by object field. I would have the product table indexed by the seller ID. Then it is optimized to select products by seller-ID.
closing because of small scale an duplication or indexing can yield similar benefits
https://github.com/silentshop/react/blob/b03ef4882b58a4bc4c1e67df3e491b7f33d27ce4/server/lib/routes/products.js#L99
Instead of having only two tables, users and products, and querying /products?userID=userID, Server is set up for duplication so that we if we have a userID, we can go to user-products/userID and not have to scan the entire products table