node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »



Node.js server module for querying couchdb and returning results to jQuery datatables.

Note: This is an alpha version. Use at your own risk. It has not been heavily tested. Please see TODO.


  • Node.js
  • CouchDB
  • couchdb-lucene (


Step 1) npm install couchtable

Step 2) For the time being, you'll need to manually install your index view. I do plan on creating a generator for the long term. Any json keys you wish to have as column headers will need to be in this view in the format below (title is the name of our json key):

  index("title", doc.title, {"store": "yes"});

Full Example:

function (doc){
    // doc.type is for filtering doc types. If you use this method of filtering. Leave it.
        index("type", doc.type, {"store": "yes"});
  // Add indexes for the json keys you want to be searchable in the datatables
        index("title", doc.title, {"store": "yes"});
        index("author",, {"store": "yes"});
        index("email",, {"store": "yes"});
  1. Include couchtable var couchtable = require('couchtable');

  2. Use at your own risk. See note above.


Example using express.js

var couchtable = require('couchtable');
var table = new couchtable('http://user:pass@localhost');
app.get('/datatable', function(req, res){
  var params = {
    db: 'dbname',
    designname: 'designname',
    viewname: 'couchtable',
    docType: 'users',
    aColumns: ['firstName', 'lastName', 'email'],
    stale: 'ok',
    urlParams: req.params
  table.query(params, function(err, result){


query(params, callback)


  • Add test cases
  • Save URL params from being injected with garbage
  • Add in more detailed and nicer error handling
  • View generator to create search index automatically