title: How to create an Auto-ID inside a firestore document?
body: <p>I am trying to achieve this for the friend request functionality in my data structure for sent requests, but I am unable to: 
  <a href="https://i.stack.imgur.com/uLE9d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uLE9d.png" alt="This is the structure of the sent_requests collection"></a></p>
  
  <p>Essentially I am trying to pull this off from the Realtime Database in the Cloud firestore:
  <a href="https://i.stack.imgur.com/eqjHI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eqjHI.png" alt="enter image description here"></a>
  Above reqId1 and reqId2 are automatically generated Id's.
  Its quite easy to pull this off in the Realtime db as I can just use the <code>push() method</code>.
  The issue is not creating a random number, it is that I am unable to create a document with an autoID inside the userId document in which I shall store the data.</p>
  
  <p>I have tried this:</p>
  
  <pre class="lang-js prettyprint-override"><code>sendRequest() {
      const uid = auth().currentUser.uid;
      firestore()
        .collection('Sent_Reqs')
        .doc(`${uid}`)
        .collection(`${this.autoId()}`)
        .add({
          targetId: this.userId,
          sentAt: new Date(),
        });
    }
  </code></pre>
  
  <p>But the above doesn't do any good because it nests the data two levels inside the document(uid).</p>
  
  <p>Please help me</p>
  
  <p>Thank you</p>