title: MongoDB Java Driver aggregation with regex filter
body: <p>I am using MongoDB Java Driver 3.6.3.
  I want to create regex query with group by aggregation to retrieve distinct values.</p>
  
  <p>Let's say I have json:</p>
  
  <pre><code>[{
    "name": "John Snow",
    "category": 1
  },
  {
    "name": "Jason Statham",
    "category": 2
  },
  {
    "name": "John Lennon",
    "category": 2
  },
  {
    "name": "John Snow",
    "category": 3
  }]
  </code></pre>
  
  <p>I want to create query where regex is like "John.*" and group it by name so there would be only one "John Snow"</p>
  
  <p>Expected result is:</p>
  
  <pre><code>[{
    "name": "John Snow",
    "category": 1
  },
  {
    "name": "John Lennon",
    "category": 2
  }]
  </code></pre>