【发布时间】:2014-11-03 08:05:43
【问题描述】:
我是 Couchbase 的新手。 我正在尝试从 Couchbase Server 3.0.1 上的 Couchbase Documents 使用 Node.js 进行一些基本操作。 当我尝试批量操作时,从 Couchbase 文档中获取的代码失败了。
有一个名为“test”的数据桶。并且bucket有2条记录,它们的doc号为1和2。如果我一个一个拿到文档,我就可以成功。
但以下代码返回错误,例如;
throw new TypeError('第一个参数需要是字符串或缓冲区。');
我的代码;
var couchbase = require("couchbase");
var cluster = new couchbase.Cluster('192.168.170.129:8091');
var bucket = cluster.openBucket('test');
// Bulk operation
bucket.get(['1', '2'], function(err, res) {
if(err) {
console.log("one or more operation failed", err);
return;
}
console.log("success!", res);
});
已编辑:我使用的是 Couchbase Node.js 2.0
【问题讨论】:
-
您使用的是哪个版本的 Couchbase Node.js SDK?
-
我使用的是 Couchbase Node.js 2.0。
标签: node.js couchbase couchbase-lite couchnode