title: How to extract distinct values from a mongo database using Waterline and Sails.js (version 0.10)?
body: <p>Using <code>Sails.js</code> version <code>0.10.x</code>, assume I have a model <code>Dog</code>, populated as follows (writtenout in <code>yaml</code> format for convenience, but in my case it's actually in a <code>mongo</code> database.)</p>
  
  <pre><code>dogs:
  -  breed: "wolf"
     name: "Fido"
  -  breed: "wolf"
     name: "Roger"
  -  breed: "dingo"
     name: "Nipper"
  -  breed: "dingo"
     name: "Ernie"
  -  breed: "corgi"
     name: "Bernadi"
  -  breed: "corgi"
     name: "Queenie"
  -  breed: "poodle"
     name: "Christopher"
  -  breed: "poodle"
     name: "Tony"
  
  etc
  </code></pre>
  
  <p>So now I want to create a list of the available breeds.</p>
  
  <pre><code>Dog.find().exec(err, dogs) {
    breeds = [];
    dogs.each(function(dog)) {
      if (breeds.indexOf(dog.breed) === -1) breeds.push(dog.breed);
    }
    ...
  }
  </code></pre>
  
  <p>Is there a simpler way to do this with fewer hits on the database? Something like</p>
  
  <pre><code>Dog.find().distinct('breed').exec(function(err, breeds){
    ...
  });
  </code></pre>
  
  <p>I've found <a href="https://github.com/balderdashy/waterline/issues/60" rel="nofollow">this closed Waterline issue</a> which seems to indicate that I could use a <code>.distinct</code> method but I tried it and alas no dice.</p>
  
  <pre><code>Object [object Object] has no method 'distinct'
  </code></pre>
  
  <p>How might I go about this in a database efficient manner?</p>