how do sort data desc or asc?

9 views
Skip to first unread message

迷路

unread,
Jun 25, 2016, 7:10:30 PM6/25/16
to PouchDB
api like this:


function map(doc) {
 
// sort by last name, first name, and age
 
emit([doc.lastName, doc.firstName, doc.age]);
}
db.query(map).then(function (result) {
 
// handle result
}).catch(function (err) {
 
console.log(err);
});


but i want to sort data desc or asc

use sql like this:

select * from table order by lastName desc


how to do it?  thanks!

Nolan Lawson

unread,
Jul 14, 2016, 2:11:33 PM7/14/16
to PouchDB
When you query, you can do descending: true or descending: false. There' s a blog post on it here: https://pouchdb.com/2014/04/14/pagination-strategies-with-pouchdb.html

 
Reply all
Reply to author
Forward
0 new messages