title: accessing mongodb from nodejs - common CRUD methods
body: <p>I am new to mongodb and nodejs.So far I have been able to create a new mongodb database and access it via nodejs. However I want to write some generic set of methods for accessing collections (CRUD), as my list of collections will grow in number. For example I have a collection which contains books and authors</p>
  
  <pre><code>var books = db.collection('books');
  var authors = db.collection('authors');
  
  exports.getBooks = function(callback) {
      books.find(function(e, list) {
          list.toArray(function(res, array) {
              if (array) callback(null, array);
              else callback(e, "Error !");
          });
      });
  };
  </code></pre>
  
  <p>Similar to this I have the method for getting authors as well.Now this is getting too repetitive as I want to add methods for CRUD operations as well. Is there a way to have common/generic CRUD methods for all my collections ?</p>