title: express-Handlebars: Error: Missing helper: "for"
body: <p>I am trying a very basic handlebars template as follows:</p>
  
  <pre><code>// movies.hbs
  &lt;h1&gt;Movies&lt;/h1&gt;
  &lt;ul&gt;
      {{#for movies}}
          {{#if this}} 
              &lt;li&gt;&lt;a href="http://www.imdb.com/title/{{ this.title }}"&gt;{{ this.title }}, {{ this.year }}
              {{this.genre}}&lt;/a&gt;    
              &lt;/li&gt;     
          {{else}}
              &lt;li&gt;No movies found.&lt;/li&gt;
          {{/if}}
      {{/for}}
  &lt;/ul&gt;
  </code></pre>
  
  <p>However, when I render it using the retreived docuements from the MongoDB database, </p>
  
  <pre><code>MongoClient.connect("mongodb://localhost:27017/vidoes", function(err, db) {
  
          if (err) throw err;
          db.collection('movies').find({}).toArray(function(err, docs) {
          if (err) throw err;
          app.get('/', function(req, res){
              res.render('movies', {'movies':docs});
          });
          app.use(function(req, res){
              res.sendStatus(404);
          });
          var server = app.listen(3000, function() {
              var port = server.address().port;
              console.log("Express server listening on port %s.", port);
          });
      });
  });
  </code></pre>
  
  <p>I get the weird error:</p>
  
  <pre><code>$ node app.js                                                                                                                                                                              
  Express server listening on port 3000.
  Error: Missing helper: "for"
      at Object.&lt;anonymous&gt; (/public_html/All Together Now/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19:13)
      at Object.eval [as main] (eval at createFunctionContext (/public_html/All Together Now/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), &lt;anonymous&gt;:6:89)
  </code></pre>
  
  <p>When i try it without the database, it gives me the same error. Of course, after I visit the homepage.</p>
  
  <pre><code>    app.get('/', function(req, res){
            var docs = [{ "title" : "Minuscule: Valley of the Lost Ants (Minuscule - La vallée des fourmis perdues)", "genre" : "Adventure|Animation|Children", "year" : 1993 },
  {  "title" : "Bambi Meets Godzilla", "genre" : "Animation|Comedy", "year" : 2003 },
  { "title" : "Annie Get Your Gun", "genre" : "Musical|Western", "year" : 2011 },
  { "title" : "Scary Movie 5 (Scary MoVie)", "genre" : "Comedy", "year" : 2005 }
  ];
            res.render('movies', {'movies':docs});
        });
  
  var server = app.listen(3000, function() {
              var port = server.address().port;
              console.log("Express server listening on port %s.", port);
          });
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>CS</p>