Re: how to sort data order by desc or asc?

90 views
Skip to first unread message

Garren Smith

unread,
Jun 26, 2016, 1:25:20 PM6/26/16
to pou...@googlegroups.com
Hi,

If you add {descending: true} to the options field when you do db.query(name, options) and that will give you what you want. https://pouchdb.com/api.html#query_database

Cheers
Garren

On Sat, Jun 25, 2016 at 10:51 PM, 迷路 <milu2...@gmail.com> wrote:
and i see 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 order by desc or asc .

use sql like this :

select  * from  table  order  by  lastName   desc

how to do it ? thanks!!





--
You received this message because you are subscribed to the Google Groups "PouchDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pouchdb+u...@googlegroups.com.
To post to this group, send email to pou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pouchdb/64b38095-261c-467c-9259-87ffd4aae5ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages