title: How do you do a groupwise max in Cloud Firestore?
body: <p>I'm learning to use Cloud Firestore with Flutter. </p>
  
  <p>Say I've got a collection called Updates:</p>
  
  <pre><code>{
    uid: 1234,
    update: "At work",
    date: &lt;timestamp&gt;
  }
  </code></pre>
  
  <p>I want to get the most recent update for each user. If I have a list of users, I could do:</p>
  
  <pre><code>db.collection("updates")
    .where("uid", "==", $uid)
    .orderby(date desc)
    .limit(1)
    .get();
  </code></pre>
  
  <p>for each one. But how would I get a list of users from my Updates collection? Do I need to store a separate collection of users which I ensure is unique, and keep it in sync with my updates collection? </p>
  
  <p>If I'm doing that, is there a good way to do the retrieval in one step, or do I have to get all the users and then iterate over them and retrieve their most recent document ID and request that document?</p>
  
  <p>I'm coming from a mysql background and I think I am Doing It Wrong :| </p>