I am sending data to firebase with the following piece of code which is working:
var mac = "10:10:10:10";
var ref = rootRef.child('user/' + 'nicolas');
if(pass == "4920" ){
 ref.update({
   1: mac
 });
}  
What I need to do is replace the '1' with a variable, since I need to change the value dinamically. I tried the following:
var mac = "10:10:10:10";
var ref = rootRef.child('user/' + 'nicolas');
var index = 1;
if(pass == "4920" ){
 ref.update({
   index: mac
 });
}  
But the result is that the mac address is stored inside "index" directory, and no the directory called "1". Thanks.
 
     
    