You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Volker Mische <vo...@gmail.com> on 2008/12/13 12:00:47 UTC
View collation
Hi,
I've read about view collation in cmlenz' blog
(http://www.cmlenz.net/archives/2007/10/couchdb-joins). The problem I
have at the moment is similar, but I need an additional feature. I'd
like to have a view that returns the blog entry along with all comments
of a certain time range.
A query would look like:
...?startkey=["myslug", 0, 20081201]&endkey;=["myslug", 2, 20081212]
The problem is that the entry might have been posted in November, thus
it doesn't contain a date within that range. Is there a way that the
entry will be returned though without the need of 2 GET requests (one
for the entry, one for the comments).
Cheers,
Volker
Re: View collation
Posted by Volker Mische <vo...@gmail.com>.
Hi,
I could of course drop the comments I don't want on the application
side. The point is that I only want to have the comments of a certain
date range returned, not all of them.
Cheers,
Volker
Simon Metson wrote:
> Hi
> The 0 or 1 is arbitrary, so long as the child document has a higher
> number than the parent you are ok. If you express your date as a number
> you could use that instead of the 0 and 1, I think, to see all posts in
> a date range. The problem is you would get orphaned comments, but I
> think it's easier to drop them in the application.
> Hope that helps
> Simon
>
> This is coming from my iPhone, please see five.sentenc.es if you feel
> this mail is rather short
>
> On 13 Dec 2008, at 11:00, Volker Mische <vo...@gmail.com> wrote:
>
>> Hi,
>>
>> I've read about view collation in cmlenz' blog
>> (http://www.cmlenz.net/archives/2007/10/couchdb-joins). The problem I
>> have at the moment is similar, but I need an additional feature. I'd
>> like to have a view that returns the blog entry along with all comments
>> of a certain time range.
>>
>> A query would look like:
>> ...?startkey=["myslug", 0, 20081201]&endkey;=["myslug", 2, 20081212]
>>
>> The problem is that the entry might have been posted in November, thus
>> it doesn't contain a date within that range. Is there a way that the
>> entry will be returned though without the need of 2 GET requests (one
>> for the entry, one for the comments).
>>
>> Cheers,
>> Volker
Re: View collation
Posted by Simon Metson <si...@cern.ch>.
Hi
The 0 or 1 is arbitrary, so long as the child document has a higher
number than the parent you are ok. If you express your date as a
number you could use that instead of the 0 and 1, I think, to see all
posts in a date range. The problem is you would get orphaned comments,
but I think it's easier to drop them in the application.
Hope that helps
Simon
This is coming from my iPhone, please see five.sentenc.es if you feel
this mail is rather short
On 13 Dec 2008, at 11:00, Volker Mische <vo...@gmail.com> wrote:
> Hi,
>
> I've read about view collation in cmlenz' blog
> (http://www.cmlenz.net/archives/2007/10/couchdb-joins). The problem I
> have at the moment is similar, but I need an additional feature. I'd
> like to have a view that returns the blog entry along with all
> comments
> of a certain time range.
>
> A query would look like:
> ...?startkey=["myslug", 0, 20081201]&endkey;=["myslug", 2, 20081212]
>
> The problem is that the entry might have been posted in November, thus
> it doesn't contain a date within that range. Is there a way that the
> entry will be returned though without the need of 2 GET requests (one
> for the entry, one for the comments).
>
> Cheers,
> Volker