title: How to update fields in Firestore map
body: <p>Don't know how to go about adding new fields into a map in Firestore using a variable rather then a hardcoded field name.</p>
  
  <p>I have a data structure in firestorm. The collection is called webQuiz and the document is called '12345. The data structure looks like:</p>
  
  <pre><code>    roomName: Demo0
      roomNumber: 46532
      people:{11111:"David, 22222:"Peter}
  </code></pre>
  
  <p>Note that people is a map data object. </p>
  
  <p>I would like to add another field to the people map. The code below works but instead of the data looking like 
  <code>people:{11111:"David, 22222:"Peter, 44444:"Cathy"}</code> it looks like
  <code>people:{11111:"David, 22222:"Peter, x:"Cathy"}</code></p>
  
  <p>How can I use a variable which holds the field name in this situation? The x should be a variable but it is picked up literally as a property. </p>
  
  <pre><code>    function testing(){
  
        var x = "44444"
        var y = "Cathy"
  
        var cityRef = db.collection('webQuiz').doc('12345');
  
      var setWithMerge = cityRef.set({
        people: {x: y}
      }, { merge: true });
  
  </code></pre>
  
  <p>I expect the output in firestorm to be
  people:<code>{11111:"David, 22222:"Peter, 44444:"Cathy"}</code> but the actual output at the moment is
  people:<code>{11111:"David, 22222:"Peter, x:"Cathy"}</code></p>
  
  <p>Thanks</p>