title: Firebase cloud functions: How to get the reference to the document with wildcard notation?
body: <p>Here are what I am trying to do with Firebase cloud functions:</p>
  
  <ol>
  <li><p>Listen to change in one of the documents under 'public_posts' collection.</p></li>
  <li><p>Tell if the change is in the 'public' field from true to false</p></li>
  <li><p>If true, delete the document that triggered the function</p></li>
  </ol>
  
  <p>For steps 1&amp;2, the code is straightforward, but I don't know the syntax for step 3. What would be the way to get the reference of the document that triggered the function? That is, I'd like to know what would be the code in question for the empty line below:</p>
  
  <pre><code>exports.checkPrivate = functions.firestore
  .document('public_posts/{postid}').onUpdate((change,context)=&gt;{
       const data=change.after.data();
       if (data.public===false){
           //get the reference of the trigger document and delete it 
       }
       else {
           return null;
       }
  });
  </code></pre>
  
  <p>Any advice? Thanks!</p>