Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Firebase give manually added objects an unique key?

Is it possible when adding data manually to the Firebase database, through the dashboard, to let Firebase give each new object an unique key?

enter image description here

like image 317
Thore Avatar asked Aug 01 '17 13:08

Thore


People also ask

How to add a unique key to a Firebase Database?

So for adding data, use only uniqueKeyRef reference. So, using this code you'll create a unique id only once. You'll be able to add those childs under a single id. If you want another key, see UUID which can help you generate unique keys for your Firebase database without having to use the push () method. Show activity on this post.

How to add multiple children to the same Firebase child key?

To solve this, the Firebase clients provide a push () function that generates a unique key for each new child. By using unique child keys, several clients can add children to the same location at the same time without worrying about write conflicts.

How to add a new node to a firebase activity?

You can create a unique key in Firebase database using push () and then add child nodes under that key. Now next time when you come to that activity, first check if parent node exists or not. If the node exists, save parent node key and use it to save new child nodes. Now using the parentKey, you can add child node using that reference.

What happens if someone gets my Firebase API key?

If you use password-based Firebase Authentication and someone gets hold of your API key, they will not be able to access any of your Firebase project's database or Cloud Storage data as long as this data is protected by Firebase Security Rules.


Video Answer


1 Answers

No, you cannot. To achieve this, you need to use the push() method programmatically. This method will generate a unique key that can be saved in your database and used later in your project.

Please see official documentation regarding saving data into a Firebase database.

Hope it helps.

like image 177
Alex Mamo Avatar answered Oct 20 '22 14:10

Alex Mamo