title: Mongoose Query to Find Unique Values
body: <p>In my MongoDB backend I want to create an endpoint that returns all the unique values for a property called <code>department</code>. Now, if I were doing this in IntelliShell I would just do something like:</p>
  
  <pre><code>db.staffmembers.distinct( "department" )
  </code></pre>
  
  <p>This will return an array of all the values for <code>department</code>.</p>
  
  <p>But how do you return all unique values within a Mongoose find() query like this one? </p>
  
  <pre><code>Staffmember.find({ name: 'john', age: { $gte: 18 }});
  </code></pre>
  
  <p>In other words, what would the syntax look like if I want to use a <code>find()</code> like above, to return all unique values for <code>department</code> within the "staffmembers" collection?</p>