The docs say Firebase push generates a unique key, I want to know if this key is unique across my whole database (or even a GuId), or just in the node where it was pushed on
It is statistically nearly impossible to get duplicate push-Ids. For it to happen:
One of the core developers wrote a blog post describing how they are generated: https://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html
"A push ID contains 120 bits of information. The first 48 bits are a timestamp, which both reduces the chance of collision and allows consecutively created push IDs to sort chronologically. The timestamp is followed by 72 bits of randomness, which ensures that even two people creating push IDs at the exact same millisecond are extremely unlikely to generate identical IDs. One caveat to the randomness is that in order to preserve chronological ordering if a client creates multiple push IDs in the same millisecond, we just 'increment' the random bits by one."
It is unique across the whole database. From the documentation:
Generate a new child location using a unique name and returns a Firebase reference to it. This is useful when the children of a database location represent a collection of items. See Saving Lists of Data.
You can optionally pass a value to push() and the value will be immediately written to the generated location. If you don't pass a value to push(), nothing is written and the child will remain empty unless written to using set().
The unique name generated by push() is prefixed with a client-generated timestamp so that the resulting list will be chronologically-sorted.