Reputation: 49
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?
Upvotes: 3
Views: 3115
Reputation: 39605
Cradle 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);
}
});
Upvotes: 7