How To Create A Custom Key In Firebase Database

JavaScript

02/08/2021


In the realtime database of Firebase, whenever you push() a new node, a key/id is automatically generated for it. However, you can easily create a custom key the following way:

JAVASCRIPT
firebase.database().ref(`some/path/${customKey}`).set({})

If you've got no data to add, it's important to still push an empty object or else the node with the custom key will not be created.


WRITTEN BY

Code and stuff