I have this dilema, I wanted to use multiple orderBy queries but apparently firebase does not support this.
People can search for a product based on price range, leading to this query:
ref.orderByChild("price").startAt(minPrice).endAt(maxPrice).once('value')
The problem is that I want to then randomize the products to give a fair chance to those products that have been seen less, I decided to add a productViewCount... I wanted to then orderBy ViewCount showing the ones with the least views first, but I am not sure that will truly randomize it, because old products on the platform first might never be seen later on with new products since they will always start with less.
How can I randomize the query based on matching the price range? Using Node.JS and this has to happen on the backend.
Thanks.
via Lion789
No comments:
Post a Comment