Shady Chan Shady Chan - 27 days ago 17
AngularJS Question

Firebase working with list data

"groups": {

"techpioneers": {

"name": "Historical Tech Pioneers",

"members": {
"alovelace": true,
"ghopper": true,
"eclarke": true
}
},
...


}

This kind of structure is found in firebase docs but I can't figure out how to do the "members" child. How to write the 'wildcard' username as the key and boolean as the value?

Sam Sam
Answer

You actually just write the boolean value (or the username object) to the database. The needed child nodes are created, when you add the first child.

For example:

firebase.database().ref('groups/techpioneers/members' + username).set(true);

or

firebase.database().ref('groups/techpioneers/members').set({username: true});
Comments