How can I get next key value (User03) continue from last recent key (User02) like image below:
Asked
Active
Viewed 193 times
0

Diego Venâncio
- 5,698
- 2
- 49
- 68

Kanzt
- 135
- 1
- 6
- 13
-
Answer below. If you insist on this structure, I recommend giving it a try and letting us know if you get stuck (with a [minimal complete verifiable example of where you got stuck](http://stackoverflow.com/help/mcve)). – Frank van Puffelen Jun 17 '18 at 13:31
-
How User01 and User02 was generate? – Diego Venâncio Jun 17 '18 at 16:13
-
@DiegoVenâncio i'm add it manual – Kanzt Jun 17 '18 at 18:25
-
@Kanzt, right. And how will be add this data? Which language programming? Firebase cant guess your data structure... – Diego Venâncio Jun 17 '18 at 19:24
1 Answers
0
To know the next key in this sequence, you will need to first load all the current keys.
This is one of the many reasons Firebase recommends against using arrays, since such an operation doesn't scale well, and will only work while the user is connected to the database. I recommend reading best practices for arrays in Firebase and what are Firebase push IDs.

Frank van Puffelen
- 565,676
- 79
- 828
- 807