title: How to increase post id when a new document is inserted into firebase?
body: <p>Is there a way to increase the post ID for every document added into the database so my data will look like this.</p>
  <p>First insert:</p>
  <pre><code>{
      &quot;createdAt&quot;: &quot;2020-09-27T21:35:12.276Z&quot;,
      &quot;postId&quot;: &quot;1&quot;,
      &quot;body&quot;: &quot;This is my first post&quot;,  
  }
  </code></pre>
  <p>Second insert:</p>
  <pre><code>{
      &quot;createdAt&quot;: &quot;2020-09-27T21:37:39.165Z&quot;,
      &quot;postId&quot;: &quot;2&quot;,
      &quot;body&quot;: &quot;This is my second post&quot;,  
  }
  </code></pre>
  <pre><code>exports.postOnePost = (req, res) =&gt; {
    if (req.body.body.trim() === &quot;&quot;) {
      return res.status(400).json({ body: &quot;Body must not be empty&quot; });
    }
  
    const newPost = {
      createdAt: new Date().toISOString(),
      postId: ,
      body: req.body.body,
    };
  
    db.collection(&quot;posts&quot;)
      .add(newPost)
      .then((doc) =&gt; {
        console.log(doc.id)
      })
      .catch((err) =&gt; {
        res.status(500).json({ error: &quot;something went wrong&quot; });
        console.error(err);
      });
  };
  </code></pre>