title: NodeJS + Mongo - how to get the contents of collection?
body: <p>I'm writing a simple NodeJS app with mongo. For connecting to mongo I use:</p>
  
  <pre><code>var mongo = require('mongodb'),
  Server = mongo.Server,
  Db = mongo.Db,
  ObjectID = require('mongodb').ObjectID;
  db.open(function(err,db) {...};
  </code></pre>
  
  <p>So, I have database "docs", and I've created a collection called "companies". Now it has 4 objects (records) in it. I want to get the full contents of this collection as an array and show them line-by-line:</p>
  
  <pre><code>//get companies list
  app.get('/companies',function(req,res){
  db.collection("companies",function(err,collection){
      collection.find({},function(err, companies) {
          companies.forEach(function(err,company){
                  console.log (company);
              }
          );
      });
  });
  });
  </code></pre>
  
  <p>However, Node returns me such error:</p>
  
  <pre><code>TypeError: Object #&lt;Cursor&gt; has no method 'forEach'
  </code></pre>
  
  <p>Any ideas? Thanks in advance.</p>