I have data in my Firebase that looks something like this (this is a Javascript-based web app):
bids
400
1
50.00
2
Since you're building your query like this:
dataRef.child('bids').child(auction).child(lotno).on(...
You will have to create attach a new listener (and turn off
the existing listener) every time one of the action
or lotno
variables changes.
It sounds like there can only be a single current lot at a time, which might make it more useful to model that into your data model:
bids
400
1
50.00
2
60.00
401
1
55.00
current
65.00
Then once the bidding on the current lot has finished, you can "retire" it to its proper lotnumber slot and have the next lot become the current
. With a data structure like this, your listener for an auction could always be watching current
:
dataRef.child('bids').child(auction).child('current').on(...