Is there any solution that allow me to get the name of tables of my database as shown in the picture
You could try something like this:
firebase.database().ref().once('value', function(snapshot) {
if (snapshot.val() !== null) {
var tableNames = Object.keys(snapshot.val());
console.log(tableNames); // ["answers", "blocks", "chats", "classes"]
}
});
So that gets that whole database and then gets the top level keys from the returned object.
References:
https://firebase.google.com/docs/database/web/read-and-write#read_data_once
In some cases you may want a snapshot of your data without listening for changes, such as when initializing a UI element that you don't expect to change. You can use the
once()
method to simplify this scenario: it triggers once and then does not trigger again.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
The Object.keys() method returns an array of a given object's own enumerable properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With