MongoDB - find ids of documents with the highest value in a group
<p>Assume the following collection:</p>

<pre><code>_id:1, humanId:A, value:10
_id:2, humanId:A, value:20
_id:3, humanId:B, value:33
</code></pre>

<p><strong>Question:</strong></p>

<p>What is the easiest way to find the ids of the documents that have the highest <code>value</code> when grouped by <code>humanId</code>, i.e. to get the output <code>[2, 3]</code>.</p>

<p><strong>Bonus question:</strong></p>

<p>Can this be done using Doctrine ODM query builder?</p>