title: Simple MongoDB query find item age > 10 learnyoumongo find function
body: <p>I'm going through <a href="https://github.com/evanlucas/learnyoumongo/blob/master/exercises/find/problem.md" rel="nofollow">learnyoumongo</a> and I'm stuck on part 3. Basically a test database is included in the challenge, it is full of parrots, and the goal is to select the parrots whose age is greater than the input. I'm getting a weird error and google is full of mongo 2.x solutions to not exactly the same problem and I'm using mongo 3.0</p>
  
  <p>This is the javascript code:</p>
  
  <pre><code>var mongo = require('mongodb').MongoClient;
  var parsedInput = parseInt(process.argv[2]);
  var results;
  
  mongo.connect('mongodb://localhost:27017/learnyoumongo', function(err, db){
      results = db.collection('parrots').find({ age: { $gt: parsedInput } } ).toArray(function(err, doc) //find if a value exists
      {
          if(doc) //if it does
          {
              console.log(doc);
          }
          else{
              console.log(err);
          }
      });
      //console.log(results);
      db.close();
  });
  </code></pre>
  
  <p>This is the weird error message:</p>
  
  <blockquote>
    <p>PS C:\git\learnyoumongo> node .\test.js { [MongoError: server localhost:27017 sockets closed]
      name: 'MongoError',
      message: 'server localhost:27017 sockets closed' }</p>
  </blockquote>
  
  <p>I tried restarting mongo, but I'm still not able to pull any of the 'parrots' data out. Even with just <code>find({})</code></p>