Is it possible to use wildcards in the path of a firebase observer ?
Right now I have :
self.ref?.child('root').child('info').observe(
DataEventType.childChanged, with: { (snapshot) -> Void in
//do something
})
Is there any way to achieve something like :
self.ref?.child('root').child('info').child(<wildcard>).child('details').observe(
DataEventType.childChanged, with: { (snapshot) -> Void in
//find out what the wildcard is & do something
})
Thanks
There is no way to observe a subset of nodes like that. Your options are:
info
, which childAdded
, etc.details
to a new top-level node and observe on there.The first option works with your current data structure. But it will read more data than you're interested in. The second option doesn't download too much data, but you'll need to change your data structure.