title: MapReduce function MongoDB NodeJs
body: <p>I am trying to return a field of every object in my collection in form of array using mapReduce function. These are my documents in a collection.</p>
  
  <pre><code> { _id: '1', name: 'a' },
   { _id: '2', name: 'b' },
   { _id: '4', name: 'c' },
   { _id: '5', name: 'd' },
   { _id: '6', name: 'e' },
   { _id: '7', name: 'f' }
  </code></pre>
  
  <p>Now i want result in this form <strong>['a','b','c','d','e','f']</strong>. How i can achieve it, i tried mapReduce but couldn't get the result in this way.</p>
  
  <p>This is  my code</p>
  
  <pre><code>collection.mapReduce( function EachBranch(  ) {
        emit( this.name, this.value);
        }, function ( key, values ) {
        },{ out: { inline: 1 } });
  </code></pre>