title: How to update firebase with array of objects?
body: <p>For an example we have the database:</p>
  
  <pre><code>//the database
  firebase: {
    1: a,
    2: b,
    3: c
  }
  
  //the ref 
  var firebaseRef = firebase.database().ref();
  
  //what we need
  var change = [
    {
      id: 2,
      value: "y"
    },
    {
      id: 3,
      value: "z"
    },
  ];
  
  //a possible way how we want
  firebaseRef.update({
    change[0].id: change[0].value,
    change[1].id: change[1].value
  })
  </code></pre>
  
  <p>I have a few questions. </p>
  
  <p>The last block needs to loop through the array. But i don't know if it is a good practice to call update repeatedly. </p>
  
  <p>The second important thing is that while the keys above only have one value, it's good, but if it's an object which has a few properties, the only one we want to set will override the other properties. I think the best way to solve this to create a loop with setting the database's child to the array's actual object's id or key, and then update the necessary properties. </p>
  
  <p>But isn't it a bad practice to loop through an array and call the update function repeatedly?</p>