admin管理员组文章数量:1425791
The get()
method of the Cradle library requires me to provide an _id
. CouchDB provides an _all_docs
view, but there's nothing in the Cradle documentation about this.
How can I get all documents from a single CouchDB database with Cradle?
The get()
method of the Cradle library requires me to provide an _id
. CouchDB provides an _all_docs
view, but there's nothing in the Cradle documentation about this.
How can I get all documents from a single CouchDB database with Cradle?
Share Improve this question edited Aug 15, 2013 at 7:46 Octavian Helm 39.6k19 gold badges99 silver badges102 bronze badges asked Sep 30, 2012 at 15:51 user1684434user1684434 491 silver badge2 bronze badges1 Answer
Reset to default 7Cradle provides an all()
method which acts on a database. It queries the _all_docs
view and returns the results.
It should look something like this.
var cradle = require('cradle'),
db = new(cradle.Connection)().database('your-db');
db.all(function(err, res) {
if (err) {
console.log('Error: %s', err)
} else {
console.log(res);
}
});
本文标签: javascriptGetting all documents of a database in CouchDBStack Overflow
版权声明:本文标题:javascript - Getting all documents of a database in CouchDB - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745451513a2658908.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论