So in my realtime database it would look like:
ss: {
xx: {
id: 1
},
yy: {
id: 2
},
...
}
I tried to first get child with largest ID FirebaseRef.child('ss').orderByChild('id').limitToLast(1)
and then do +1 for retrieved value.. then push
new record with that. But that could result doubling id's, as between the fetch and the push, someone else can make a new record. I looked into transaction
feature, but could not figure out have to use that in my scenario (as it retrieves and updates only values?).