title: Unit testing node.js model code accessing mongodb, without actually accessing the database
body: <p>For example, I have the code below:</p>
  
  <pre><code>var db = require('./_mongo.js');
  module.exports = {
      check: function (cb) {
          var content = {};
          content.collection = 'counters';
          content.query = {_id: 'ping'};
          content.columns = {};
          db.read(content, function(err, result){
              if (err) {
                  cb(-1);
              }
              else {
                  cb(0);
              }
          });
      }
  };
  </code></pre>
  
  <p>How do I write a unit test for the 'check' function, without actually accessing the database, while at the same time checking if I am able to code the correct 'content' variable being passed to the read method?</p>