title: How to get count of distinct field in mongodb java driver
body: <p>I know I can get a distinct list with query like this:</p>
  
  <pre><code>db.collections.distinct("fieldName")
  </code></pre>
  
  <p>And get the length of the list with</p>
  
  <pre><code>db.collections.distinct("fieldName").length
  </code></pre>
  
  <p>But is there a way to get the <code>length</code> in mongodb-java-driver other than in a aggregation query?</p>
  
  <p>Or will implementation such as:</p>
  
  <pre><code> collection.distinct("fieldName", condition).size() 
  </code></pre>
  
  <p>is too  inefficiency?</p>