title: RethinkDB how to delete duplicated values in a list except for the latest value
body: <p>I want to reduce a list of <code>adbKeys</code> if there are duplicated <code>title</code>.
  I want to keep the latest, or the last, value in a list.</p>
  <pre><code>Query: r.db('stf').table('users').filter(r.row('adbKeys').count().gt(5))('adbKeys')
  </code></pre>
  <p>Result:</p>
  <pre><code>[
      [{
          &quot;adbKeys&quot;: [{
              &quot;fingerprint&quot;: &quot;1111&quot;,
              &quot;title&quot;: &quot;lus@344.local&quot;
          }, {
              &quot;fingerprint&quot;: &quot;1111&quot;,
              &quot;title&quot;: &quot;@bbbbb&quot;
          }, {
              &quot;fingerprint&quot;: &quot;2222&quot;,
              &quot;title&quot;: &quot;@bbbbb&quot;
          }, {
              &quot;fingerprint&quot;: &quot;4444&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;5555&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;6666&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;7777&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;8888&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }]
      }]
  ]
  </code></pre>
  <p>So I want to delete following values in the queried user:</p>
  <pre><code>[{
          &quot;fingerprint&quot;: &quot;1111&quot;,
          &quot;title&quot;: &quot;@bbbbb&quot;
      },
      {
          &quot;fingerprint&quot;: &quot;4444&quot;,
          &quot;title&quot;: &quot;@aaaaa&quot;
      }, {
          &quot;fingerprint&quot;: &quot;5555&quot;,
          &quot;title&quot;: &quot;@aaaaa&quot;
      }, {
          &quot;fingerprint&quot;: &quot;6666&quot;,
          &quot;title&quot;: &quot;@aaaaa&quot;
      }, {
          &quot;fingerprint&quot;: &quot;7777&quot;,
          &quot;title&quot;: &quot;@aaaaa&quot;
      }
  ]
  </code></pre>
  <p>In case you need to know about the table.</p>
  <pre><code>r.db('stf').table('users').get('xxxxxxxx')
  </code></pre>
  <p>Looks like:</p>
  <pre><code>{
      &quot;adbKeys&quot;: [{
          &quot;adbKeys&quot;: [{
              &quot;fingerprint&quot;: &quot;1111&quot;,
              &quot;title&quot;: &quot;lus@344.local&quot;
          }, {
              &quot;fingerprint&quot;: &quot;1111&quot;,
              &quot;title&quot;: &quot;@bbbbb&quot;
          }, {
              &quot;fingerprint&quot;: &quot;2222&quot;,
              &quot;title&quot;: &quot;@bbbbb&quot;
          }, {
              &quot;fingerprint&quot;: &quot;4444&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;5555&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;6666&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;7777&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }, {
              &quot;fingerprint&quot;: &quot;8888&quot;,
              &quot;title&quot;: &quot;@aaaaa&quot;
          }]
      }],
      &quot;createdAt&quot;: {
          &quot;$reql_type$&quot;: &quot;TIME&quot;,
          &quot;epoch_time&quot;: 1601271054.923,
          &quot;timezone&quot;: &quot;+00:00&quot;
      },
      &quot;email&quot;: &quot;xxxxxxxx&quot;,
      &quot;forwards&quot;: [],
      &quot;group&quot;: &quot;xxxxxxx&quot;,
      &quot;groups&quot;: {
          &quot;lock&quot;: false,
          &quot;quotas&quot;: {
              &quot;allocated&quot;: {
                  &quot;duration&quot;: 12960000000,
                  &quot;number&quot;: 5
              },
              &quot;consumed&quot;: {
                  &quot;duration&quot;: 0,
                  &quot;number&quot;: 2
              },
              &quot;defaultGroupsDuration&quot;: 1296000000,
              &quot;defaultGroupsNumber&quot;: 5,
              &quot;defaultGroupsRepetitions&quot;: 10,
              &quot;repetitions&quot;: 10
          },
          &quot;subscribed&quot;: [&quot;213123&quot;, &quot;123123123&quot;]
      },
      &quot;ip&quot;: &quot;44.33.11.22&quot;
  }
  </code></pre>