title: Cloud Functions for Firestore: accessing parent collection data
body: <p>Many blogs suggest to switch to Cloud Firestore because it's easy and well secured. Coming from Realtime Database and back when using Functions + RD it was easy to navigate through document triggers, like <code>ref.parent</code></p>
  
  <p>My setup is like this: </p>
  
  <blockquote>
    <ul>
    <li>Users
    
    <ul>
    <li>{userid}
    
    <ul>
    <li>last_seen: "data"</li>
    <li>{forms}
    
    <ul>
    <li>{formid}</li>
    </ul></li>
    </ul></li>
    </ul></li>
    </ul>
  </blockquote>
  
  <p>However, i have added a document trigger with <code>onCreate</code>, and i want to get the value of <code>last_seen</code>: </p>
  
  <pre><code>exports.updateUser = functions.firestore.document('users/{userId}/forms/{formid}').onCreate((snap, context) =&gt; {
  
      const newValue = snap.data();
      console.log("test value : " + newValue.test); // works
      console.log("form id: " + context.params.formid); // works
      console.log("user last seen : " + newValue.last_seen); // doesn't work, can't access the parent collection data
  
  
  });
  </code></pre>