title: MongoDB distinct, return all fields
body: <p>I'm using MongoDB and the node-mongodb-native driver.</p>
  
  <p>I'm trying to return all records with a distinct attribute. </p>
  
  <p>This seems to work, however it only returns the value which I'm checking for being distinct, not all values in each document.</p>
  
  <p>This is what I have tried to return just the name field, I've also tried without it and variations of, but it always only returns the item_id's in an array.</p>
  
  <pre><code>    this.collection.distinct("item_id", [{"name" : true}, {sold : {"$exists" : true}}], function(err, results) {
          if (err) {
              callback(err);
          } else {
              console.log(results);
          }
      });
  </code></pre>
  
  <p>Any suggestions how to get all the data from each document?</p>
  
  <p>Thank you!</p>
  
  <p>EDIT: Using Map Reduce</p>
  
  <p>So, I just setup the start of a map reduce, using the node-mongodb-native, here's what I have so far: </p>
  
  <pre><code>    var map = function() {
          emit(this._id, {"_id" : this._id, "name" : this.name});
      }
  
      var reduce = function(key, values) {
  
          var items = [];
  
          values.forEach(function(v) {
              items.push(v);
          }); 
  
          return {"items" : items};
      }
  
      this.collection.mapReduce(map, reduce, {out: "res"}, function(err, results) {
          if (err) {
              console.log(err);
          } else {
              console.log(results);
          }
      });
  </code></pre>
  
  <p>I know the logic isn't in there for distinct, but the results is the db object, I can't use 'toArray' on it.  Any ideas why this might be?</p>