title: How to extract distinct values from Waterline 0.10.x within a query?
body: <p>So I've looked around for <strong>.distinct</strong> function in waterline 0.10.x and have failed to find one, after looking on Stack Overflow I have found this...</p>
  
  <p><a href="https://stackoverflow.com/questions/24340490/how-to-extract-distinct-values-from-a-mongo-database-using-waterline-and-sails-j">How to extract distinct values from a mongo database using Waterline and Sails.js (version 0.10)?</a></p>
  
  <p>Which ALMOST solved my problem.</p>
  
  <p>So I tried looking at the native mongodb documentation and found that I can do this...</p>
  
  <pre><code>db.dogs.distinct('breed', { owner: ObjectId('123456') })
  </code></pre>
  
  <p>Which returns the distinct breeds that <em>ObjectId('123456')</em> has.</p>
  
  <p>But this doesn't work...</p>
  
  <pre><code>Dog.native(function (err, collection){ 
      collection.distinct('breed', { owner: '123456' }, function (err, breeds){
          console.log(breeds);
      });
  });
  </code></pre>
  
  <p>This gives me an empty array.</p>
  
  <p>I think the problem is that the <strong>.native</strong> function for Waterline doesn't understand when to cast the given string into an <em>ObjectId</em> and the Waterline documentation is still under-documented.</p>
  
  <p>How would I get the distinct values with a query?</p>