[Solved] Insert an object in firebase


I need some help.

How can I insert a list of objects in Firebase? I really need to insert manually the number of the sequence or it can be serialized automatically?

If I need to get the last number how can I guarantee and avoid two users to get the same last number?

Thanks in advance.


What is your problem? You can create a list of objects from JSON data and add it to the database. Or you can import JSON in the Firebase console.

After that, you can get the list of nodes from Firebase and work with it as a list of objects.

1 Like

Hi @actech I’ll be glad to hear from you an example inserting the number 8 of this list from thunkable cross. The main question is: How can I take the number 8 if I’ll have a lot of people sending messages at same time?

Thanks in advance.

The general approach looks like this:

  1. Get a list from Firebase
  2. Add a new object to the list
  3. Write a list to Firebase

If you need a unique and previously unused index, then for this you need to create another pattern in which the current maximum index will be stored.

For debugging convenience, create a global variable “cloud” and a listener for it.


I would strongly urge you to use cloud variables instead of the Realtime DB component, as they are much simpler to use (and are backed by Firebase). Similar to @actech method, they general approach would be to have the value of your cloud variable be a list, add any new objects to the list. Note that you don’t need to re-assign your list to the cloud variable after you add items to it, as it’s value will get updated and stored automatically!



4 posts were merged into an existing topic: [Sovled] Update Cloud Variables at same time?