1
Good morning ! I am working on an app that saves some user activities and I have a problem to save these activities generating sequential numbers, here is the environment: I have the user logged in, it will create a new activity and when saving it in the ACTIVITIES node it receives the id 1 number, then user B saves another activity in another cell that will receive id 2, then user A saves a new one now with id 3... and so on... Thanks in advance!
then, do the following, collect the desired firebase information if it acts, in case it is the whole type id, and add 1 every time you add something new.
– Dev
You can save the id information of the last activity as @Matheus said and use set instead of push to save the data. With set your path should already include the id that will be used. Ex:
fb.ref('atividades/${lastId+1}/').set({atividade});
– Lucas Santana