detect when a Grandchild is added, very large dataset.

184 views
Skip to first unread message

Jason Rahaim

unread,
Sep 16, 2015, 10:11:26 AM9/16/15
to Firebase Google Group
We have an endpoint with 150,000 children. (each one has 10-100 grand children). 

I am trying to detect when a child is added (easy enough) OR when a Grandchild is added. I don't, at the moment, care about the current data set, I only want to monitor for additions to it.

[firebaseRef observeEventType:FEventTypeChildAdded

Doesn't work since it didn't detect grand children being added. 


I tried: [[firebaseRef queryLimitedToLast:30] observeEventType:FEventTypeValue]
Which detects the changes, and returns the type of data I want, but it returns the same 30 children when ever anything changes even if they are not one of the ones that changes.


-Jason





Jacob Wenger

unread,
Sep 17, 2015, 2:41:56 PM9/17/15
to fireba...@googlegroups.com
Hey Jason,

To detect changes in grandchildren, you will either need to add a child_added listener at a deeper path or use a value event for each grandparent. With that many nodes, the former (using child_added) is probably your best bet. In general, adding new listeners is super cheap. Things get expensive once you start syncing a ton of data. So I would optimize for syncing less data in favor or using more Firebase listeners.

Cheers,
Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/50365895-e92b-4402-9803-3da6ee321b18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Piotr Kaminski

unread,
Sep 17, 2015, 4:25:01 PM9/17/15
to fireba...@googlegroups.com
Jason, you might also be interested in this discussion from a couple months back: https://groups.google.com/d/msg/firebase-talk/Rbjwoa_PoxE/6gZkU3IxdDwJ

    -- P.



For more options, visit https://groups.google.com/d/optout.



--
  Piotr Kaminski <pi...@ideanest.com>
  "That bun is dirty.  Don't eat that bun."

Reply all
Reply to author
Forward
0 new messages