title: Firebase Firestore update data
body: <p>I am using <code>firebase firestore</code> to create my website, this is one sample of document:</p>
  <p><a href="https://i.stack.imgur.com/FbRlU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FbRlU.png" alt="enter image description here" /></a></p>
  <p>As you can see, I have a field call <code>commentList</code> and its type is <code>array</code>, now I want to push more document in the the array and this is how I did (and it not work out, of course):</p>
  <pre><code>const {db} = require('../util/admin');
  
  exports.add__comment = (req, res, next) =&gt; {
    const {comment, displayName, uid} = req.body;
    const {id} = req.params;
  
    return db
      .collection('instagram__posts')
      .doc(id)
      .set(
        {
          commentList: [
            {comment, uid, displayName, createAt: new Date().toISOString()},
          ],
        },
        {merge: true}
      )
      .then((doc) =&gt; {
        return res.status(200).json({message: 'comment created', doc});
      })
      .catch((err) =&gt; {
        res.status(500).json({err});
        console.log(err);
      });
  };
  </code></pre>
  <p>Instead of adding more document to <code>commentList</code>, it replace all current documents with new data. Please help me and pardon me for my bad English. Once again thank you so much and have a good day.</p>