couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elf <elf2...@gmail.com>
Subject Re: sort by key
Date Tue, 22 Sep 2009 15:43:00 GMT
Do not use emit(something, doc), prefer to use include_docs=true (so,
emit(something, something_less_than_large_document) when requesting a
view.

2009/9/22 Dmitriy Novotochinov <trybeee@gmail.com>:
> Hello everybody!
>
> Please help me to implement sorting by key.
>
> Here is view function:
>
> function(doc){
>     if (doc.user && doc.user.name) {
>       emit(doc.user.name, doc);
>   }
> }
>
> Query all docs where user.name = user_name:
>
> /_design/users/_view/by_name?key=user_name
>
> Query returns docs sorted by key doc.user.name, but how to do sorting by
> doc.created_at, for example?
>
> Thanks in advance!
>
> Dmitriy Novotochinov
> jabber/googletalk: trybeee@gmail.com
> skype: trybeee
>
>
>
>



-- 
----------------
Best regards
Elf
mailto:elf2001@gmail.com

Mime
View raw message