title: Firestore how to store reference to document / how to retrieve it?
body: <p>I am new to Firestore/Firebase and I am trying to create a new document with one of the fields being a <code>document reference</code> to an other document. I have read all the guides and examples from Firebase and did not find anything...</p>
  
  <p>Also, when I retrieve this document I created, I would be able to access what is inside the reference I added inside. I have no idea how to do that.</p>
  
  <p>Here is some code I tried for the creating part</p>
  
  <pre><code>    let db = Firestore.firestore()
  
      // Is this how you create a reference ??
      let userRef = db.collection("users").document(documentId)
  
      db.collection("publications").document().setData([
          "author": userRef,
          "content": self.uploadedImagesURLs
      ]) { err in
          if let err = err {
              print("Error writing document: \(err)")
          } else {
              print("Document successfully written!")
          }
      }
  </code></pre>