[deprecated] minimalistic CouchBase client for node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.




baseview is no longer required since the view functionality is build in the latest couchnode client.

baseview is a minimalistic CouchBase client for node.js based on the minimalistic CouchDB driver nano.

CouchBase provides view data as JSON, which can be accessed and streamed with this client. To store and retrieve single documents/key-value pairs, the memcached-library is required.


  baseview = require('baseview')('')
  baseview = require('baseview')({url: '', bucket: 'my_bucket'})

  // retrieve data from a view
  baseview.view('design_doc', 'view_name', function(error, data) {
    console.log(error, data);
  // retrieve data from a spatial index with bounding box.
  // see 'sparta' for bbox calculations
  baseview.spatial('geo', 'points', {bbox: bbox}, function(error, points) {
    console.log(error, points);

  //adding a design document
  baseview.setDesign('design_doc', {
     'names': {
        'map': "function(doc){if(doc.name){emit(doc.name);}}"
      'rating': {
        'map': "function(doc){if(doc.name && doc.rating){emit(doc.rating);}}"
    function(err, res){
      // handle error http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-designdoc-api-storing.html

  // retrieve a design document
  baseview.getDesign('design_doc', function(err,res) {
    // http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-designdoc-api-retrieving.html

  // delete a design document
  baseview.deleteDesign('design_doc', function(err, res) {
    // handle error http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-designdoc-api-deleting.html

To create a geographical bounding box (bbox), have a look at sparta, a small library for geo calculations.

example with socket.io

  io.sockets.on('connection', function (socket) {
    baseview.view('feed', 'images', function(error, data) {
      socket.emit('image_feed', data.rows);


Tests are written in specify. To run the tests, execute:

node tests/views.js
node tests/spatial.js

Build Status


everyone is welcome to contribute. patches, tests, bugfixes, new features

  1. create an issue on github so the community can comment on your idea
  2. fork baseview in github
  3. create a new branch git checkout -b my_branch
  4. create tests for the changes you made
  5. make sure you pass both existing and newly inserted tests
  6. commit your changes
  7. push to your branch git push origin my_branch
  8. create an pull request


proudly presented by Patrick Heneise, Barcelona.