title: Iteration of arrays and objects in handlebars
body: <p>Schema.js</p>
  
  <pre><code>var ItemSchema = mongoose.Schema({
  username: {
    type: String,
    index: true
  },
   path: {
     type: String
   },
   originalname: {
     type: String
   }
  });
  
  var Item = module.exports = mongoose.model('Item',ItemSchema, 'iteminfo');
  </code></pre>
  
  <p>route.js</p>
  
  <pre><code>router.get('/', ensureAuthenticated, function(req, res){
    Item.find({},function(err, docs){
                  res.render('welcome', {docs:docs});
          });
  });
  </code></pre>
  
  <p>index.hbs</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      [list of data here!!!]
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Is my code in routes correct? how to display all data in <code>index.js</code>? Help please. I am a newbie in <code>node.js</code> and <code>mongoDB</code>. Thanks :)</p>
  
  <p>In mongo shell, when I hit <code>db.users.find()</code>, It has two collections. I want the desired output to be like this in index</p>
  
  <pre class="lang-none prettyprint-override"><code>username = "username1"
  path = "path1"
  originalname = "originalname1"
  
  
  username = "username2"
  path = "path2"
  originalname = "originalname2"
  </code></pre>
  
  <p>Is it possible? Like doing some <code>foreach</code> concept.</p>