title: C# MongoDB Distinct Query Syntax
body: <p>I am trying to get the distinct values from a field in MongoDB. I am having real trouble with the Syntax. Using mongoshell it's relatively easy to do, this is the query I run: </p>
  
  <pre><code>db.cmstest.distinct("categories")
  </code></pre>
  
  <p>This query returns an array of strings with all the distinct values.</p>
  
  <p>Now I am trying to get the syntax right using the latest official MongoDB Drivers, but not to much success. This is my code, which is unsuccessful:</p>
  
  <pre><code>var categoriesList = await blogContext.Articles.DistinctAsync&lt;List&lt;string&gt;&gt;("categories", "");
  </code></pre>
  
  <p>Mind you categories is a <code>List&lt;string&gt;</code>. </p>
  
  <p>Could anyone help shed some light? I've tried looking both in the documentation and online and haven't found much.</p>
  
  <p>Thank you in advance.</p>