title: Express: Query to check if the document exists
body: <p>I am developing an application in Express with mongo. I have to check if a particular document exists in the collection. I am doing this:</p>
  
  <pre><code>router.route('/').post(function (req, res, next) {
      var name = req.body.name;
      var dept = req.body.dept;
      var arr = mongoose.model('User').find({'name': name, 'dept': dept});
      if(arr.length() &gt; 0){
          //do something
      }
  }
  </code></pre>
  
  <p>What does <code>mongoose.model('User').find({'pemail': email, 'password': password});</code> actually return because when I run the app, it gives me this error:</p>
  
  <blockquote>
    <p>TypeError: undefined is not a function</p>
  </blockquote>
  
  <p>any help?</p>