title: Returning current version of each record using Google Cloud Datastore query
body: <p>I am using a relay/graphql/googlecloud setup for a project that saves data immutably.</p>
  
  <p>I have a set of fields that create a new record each time a modification is made to any of the fields structured like so:</p>
  
  <pre><code>Project
  - Start Date
  - End Date
  - Description
  - ...
  - ...
  </code></pre>
  
  <p>The first time a project is created it is saved with a timestamp and a version number. For example:</p>
  
  <pre><code>1470065550-1
  </code></pre>
  
  <p>Any modifications after this creates a new version number but still uses the same timestamp.</p>
  
  <pre><code>1470065550-2
  </code></pre>
  
  <p>Bearing in mind that it is immutable there will potentially be a lot of versions of one project. If there are also a lot of projects this could result in a large number of records being fetched </p>
  
  <p>If I want to fetch a list of projects from the datastore returning only the latest version of each one what would be the best way of going about this? As the version number increments i never know which one is the latest.</p>
  
  <p>For example if I had rows containing 2 projects, both with multiple versions and I want to fetch the latest version of each:</p>
  
  <pre><code>1470065550-1
  1470065550-2
  1470065550-3
  1470065550-4
  1470065550-5
  1470065550-6
  1470065550-7 &lt;--- Current Version for 1470065550
  1567789887-1
  1567789887-2
  1567789887-3 &lt;--- Current Version for 1567789887
  </code></pre>
  
  <p>Based on the rows above I need the query to just return the latest version of the two projects:</p>
  
  <pre><code>1470065550-7 &lt;--- Current Version for 1470065550
  1567789887-3 &lt;--- Current Version for 1567789887
  </code></pre>