couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Fouché" <nico...@silentale.com>
Subject Re: Sort by date and find by key
Date Tue, 13 Jan 2009 23:22:11 GMT
So I have to run multiple queries, then have to mix the results by
date. I need to paginate on this final resultset, and knowing that I
deal with thousands of documents, the process seems really
complicated.

e.g show documents from only one view and not the others because the
document they returned have a date greater than the results of the
first view. And then have to keep track of every keys, to call views
with some startkey and endkey.

errrrr, is CouchDB compatible with my project needs ?

Nicolas

On Wed, Jan 14, 2009 at 12:09 AM, Chris Anderson <jchris@gmail.com> wrote:
> On Tue, Jan 13, 2009 at 3:06 PM, Nicolas Fouché <nicolas@silentale.com> wrote:
>> What if I need documents from Roger and Marcel ? I suppose I cannot
>> use the 'keys' query argument in this case, right ?
>>
>
> You'll need to run multiple queries for that.
>
>> Nicolas
>>
>> On Tue, Jan 13, 2009 at 10:38 PM, Chris Anderson <jchris@gmail.com> wrote:
>>> On Tue, Jan 13, 2009 at 1:35 PM, Nicolas Fouché <nicolas@silentale.com>
wrote:
>>>> Hi,
>>>>
>>>> Let's say I have documents like this: {date: '2008/06/09 13:52:11
>>>> +0000', name:'Roger'}
>>>> I'd like to find documents matching a name, and sorted by date. I know
>>>> that for sorting documents by date, the 'date' field has to be in the
>>>> key emitted by the view.
>>>>
>>>> In this case, what to I have to emit if I need to see only documents
>>>> which name is 'Roger' but sorted by date ?
>>>> I would do something like:
>>>> emit([doc.name, doc.date], null);
>>>>
>>>> Can I query this view without having to specify the date ? I need
>>>> these documents to be sorted by date, because I'll paginate on them.
>>>
>>> Totally, all you need is a startkey and endkey that bracket the keys
>>> you care about.
>>>
>>> eg startkey=["Roger"] endkey=["Roger",{}]
>>>
>>> See http://wiki.apache.org/couchdb/View_collation
>>>
>>>>
>>>> Thanks,
>>>> Nicolas
>>>>
>>>
>>>
>>>
>>> --
>>> Chris Anderson
>>> http://jchris.mfdz.com
>>>
>>
>
>
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>
Mime
View raw message