Questions about couchbase and node.js working together

1. in github, there is no any example about using the bucket.view("design/products", "view/client", "[1,2,3]", function (?)). Does anybody have the example? especially for callback function signature

2. When I study the view function in bucket.js, I found a callback, "couchnodeRestHandler". Rest?! Does it mean the lib uses a http RESTful connection for retrieving the data rather than a persistent connection for retrieving the data?

1 Answer

« Back to question.

1. Here is a bit of my code. It gets some doc keys from view, reorganize their order (using async mudule) and then get docs by that keys:

bucket.view('DesignDocName','ViewName', options , function(err, resp, view) {
  if ( err === null && resp !== undefined && resp.length > 0){
    var keys = [];
    async.eachSeries(resp, function(item, callback){
      keys.push(item.id);
      callback(err);
    }, function(err){
      if (err === null){
        if (last === 0) keys.reverse();
        couchbase.get(keys, function (err, doc, meta) {
           if (err === null){
             // here we'll get docs one by one
           }
        });
      }
    });
  }
});

2. As far as I know in lastest version of couchnode it uses persistent connection via libcouchbase. That "rest" variables left from previous versions.