title: How do I perform a query in Mongoose?
body: <pre><code>&gt; db.users.findOne();
  {
      "_id" : ObjectId("4db8ebb4c693ec0363000001"),
      "fb" : {
          "name" : {
              "last" : "Sss",
              "first" : "Fss",
              "full" : "Fss"
          },
          "updatedTime" : "2011-04-27T09:51:01+0000",
          "verified" : true,
          "locale" : "en_US",
          "timezone" : "-7",
          "email" : "abc@gmail.com",
          "gender" : "male",
          "alias" : "abc",
  
          "id" : "17447214"
      }
  }
  </code></pre>
  
  <p>So that's my Mongo object. Now i want to find it via Mongoose:</p>
  
  <pre><code>User.findOne( { gender: "male" }, function(err, docs){
      console.log(err);  //returns Null
      console.log(docs);  //returns Null.
  });
  </code></pre>
  
  <p>That doesn't work! Neither does this:</p>
  
  <pre><code>User.findOne( { fb: {gender:"male"} }, function...
  </code></pre>
  
  <p>Null, null.</p>
  
  <p>This is my entire thing:</p>
  
  <pre><code>app.get('/:uid',function(req,res){
      params = {}
      User.findOne({ $where : "this.fb.gender == 'male' " }, function(err, docs){
          console.log(docs);
      });
      res.render('user', { locals:params });
  });
  </code></pre>