title: find all documents using mongoose
body: <p>Im trying to find all documents in a DB using mongoose but I cant do it</p>
  
  <p>I want to do it this way but I don't know what's wrong with it</p>
  
  <pre><code>app.get('/users', function (req, res){
      User.find({}, 'name', function(err, user){
          if(err){
              console.log(err);
          }else{
              res.render('user-list', {
                  name : user.name
              });
              console.log('retrieved list of names' + user.name);
          }
      })
  })
  </code></pre>
  
  <p>When I use <code>User.findOne({}, 'name', function(err, user){..</code> I get back the first doc which is what I would expect. Please explain why the code above is not allowing me to get all documents. I feel like I'm using it the right way as show in the <a href="http://mongoosejs.com/docs/2.7.x/docs/finding-documents.html" rel="nofollow"> mongoose doc </a></p>
  
  <p>Edit </p>
  
  <p>thanks for help guys</p>
  
  <p>i did like this:</p>
  
  <pre><code>app.get('/users', function (req, res){
      User.find({}, 'name', function(err, users){
          if(err){
              console.log(err);
          }else{
              res.render('user-list', {
                  name : users.map(function(doc){
                      return doc.name + "&lt;br&gt;"
                  })
              });
              console.log('retrieved list of names' + users.name);
          }
      })
  })
  </code></pre>
  
  <p>can some one please help me with getting each name on a new line the <code>"&lt;br&gt;"</code> shows up on the page but it doesn't make a new line <code>"&lt;br&gt;,Joe&lt;br&gt;,mike&lt;br&gt;"</code></p>
  
  <p>Jade:
      extend layout</p>
  
  <pre><code>block content
  
      p list of users #{name} 
  </code></pre>