title: FirebaseError: Function updateDoc() called with invalid data. serverTimestamp() is not currently supported inside arrays
body: <p>I'm trying to update the document with the new <code>comments</code> array but I'm getting this error when I submit a new comment. In every document, there is an array(comments array) of object(single comment)</p>
  <pre><code>FirebaseError: Function updateDoc() called with invalid data. serverTimestamp() is not currently supported inside arrays (found in document solutions/wLflWVhLueEKjBBknHNi)
  </code></pre>
  <p>comment submit code:</p>
  <pre><code>const handleSubmit = async (e) =&gt; {
      e.preventDefault()
  
      try {
        const commentToAdd = {
          id: Math.floor(Math.random() * 10000),
          content: newComment.trim(),
          reactions: [],
          user: {
            userID: user.uid,
            avatarURL: user.photoURL,
            displayName: user.displayName,
            username: user.reloadUserInfo.screenName,
          },
          replies: [],
          createdAt: serverTimestamp(),
        }
        await updateDocument(id, {
          comments: [...solution.comments, commentToAdd],
        })
        setNewComment(&quot;&quot;)
        if (response) {
          console.log(response.error)
        }
      } catch (error) {
        console.log(error)
      }
    }
  </code></pre>
  <p>updateDocument hook code:</p>
  <pre><code>  const updateDocument = async (id, updates) =&gt; {
      console.log(JSON.stringify(updates))
      dispatch({ type: &quot;IS_PENDING&quot; })
      try {
        const updatedDocument = await updateDoc(doc(db, c, id), updates)
        dispatchIfNotCancelled({ type: &quot;UPDATED_DOCUMENT&quot;, payload: updatedDocument })
        return updatedDocument
      } catch (error) {
        dispatchIfNotCancelled({ type: &quot;ERROR&quot;, payload: error })
        return null
      }
    }
  </code></pre>
  <p>Anyone please help me with this.</p>