I've been using
firebase.once(:value) { |snapshot| }
to query my data to this point. But now there's a serious performance issue as my data set is getting bigger.
I already know what keys I need to query, I'd rather just loop through a hand full of calls to Firebase to grab the values of the keys I need.
I'm looking for the appropriate motion-firebase call to achieve this.
Thanks.
You just need to create a new Firebase reference that points to that key or URL.
firebase = Firebase.new(YOUR_FIREBASE_URL)
keys = ["key1", "key2"]
keys.each do |key|
firebase[key].once(:value) do |snapshot|
puts "#{key} is now #{snapshot.val}"
end
end
The important bit there is firebase[key]
, which is a shorthand for the SDK method firebase.childByAppendingPath(key)
(firebase.child(key)
does the same thing).