title: Cannot get data from document in cloud functions (return undefined)
body: <p>I have a document with 2 fields: field1,field2 (changed name for simplicity).</p>
  
  <p>From a cloud function, I am trying to get the value from field1. The functions is not a trigger for that specific document, and I get the value like this:</p>
  
  <pre><code>const user_collection = db.collection("user")
  const photoName = user_collection.doc(userid).field1
  </code></pre>
  
  <p>However, the value I get in return in <code>undefined</code>. I tried with data() or get() methods, but I end up with error <code>...is not a function</code>. Can not find anything in docs or SO that helped me get the field value from the document.</p>
  
  <p>Any suggestions on how to extract that field?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>exports.onUserDeletion = functions.auth.user().onDelete((user) =&gt; {
  
      const userid = user.uid
      const photoName = user_collection.doc(userid).photo    //&lt;--- this is "undefined"
      const filePath = `user_photo/${photoName}`
      const file = bucket.file(filePath)
  
      console.log(`userid: ${userid} photoName: ${photoName} filePath: ${filePath} file: ${file}`)
  
      return highscore_collection.doc(userid).delete().then(user =&gt; {
          return user_collection.doc(userid).delete().then(user =&gt; {
              return file.delete()
          })
      })
  
  })
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/XWdGe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XWdGe.png" alt="enter image description here"></a></p>