How can I order results from a couchdb database, using cradle for node.js? From the docs it seems that adding a descending=true
parameter to my url should work. My current code is as follows:
this.db.view('articles/all',function(error, result) {
if( error ){
callback(error)
}else{
var docs = [];
result.forEach(function (row){
docs.push(row);
});
callback(null, docs);
}
});
The articles are ordered by date (as set in my view below)
function (doc) {
if (doc.created_at) emit(doc.created_at, doc);
}
If I change the first line to
this.db.view('articles/all?descending=true',function(error, result) {
no results are returned
So, how can I order results in cradle for couchdb?
Thanks!