incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: Equivalent of "select in, order by"
Date Fri, 13 Apr 2012 16:33:22 GMT
Thanks for finding the ticket! Yes, that gets you closer, but the
response would still not be quite the same as an RDBMS. You'd have two
lists to merge. If they're big, then you have a problem.

I raised this issue at the summit. I'm not sure there's a scalable
solution to this kind of join yet, but I think it's worth time
thinking on it again.

B.

On 13 April 2012 17:26, Zachary Zolton <zachary.zolton@gmail.com> wrote:
> Also, getting this featured into 1.3 would eliminate the need to make a
> request for each group:
>
> https://issues.apache.org/jira/browse/COUCHDB-523
>
> On Friday, April 13, 2012, Robert Newson wrote:
>
>> Firstly, there's often not a translation as CouchDB is not a
>> relational database. In this case, you can get much of the way;
>>
>> emit([doc.group, doc.date], null);
>>
>> then query with ?startkey=["group1"]&endkey=["group1",{}]. This
>> selects all rows where doc.group equals "group1", in date order as
>> ["group1"] is equal or lower than any possible two element array where
>> the first element equals "group1" and ["group1",{}] is greater than
>> any two element array where the second element is any string or number
>> (as objects sort higher).
>>
>> B.
>>
>> On 13 April 2012 16:02, Pankaj Jangid <pankaj.jangid@gmail.com<javascript:;>>
>> wrote:
>> > Hi,
>> >
>> > I have documents with fields 'date' and 'group'. And this is my view:
>> >
>> > byDateGroup: {
>> >  map: function(doc) {
>> >    if (doc.date && doc.group) {
>> >      emit([doc.date, doc.group], null);
>> >    }
>> >  }
>> > }
>> >
>> > What would be the equivalent query of this:
>> >
>> > select * from docs where group in ("group1", "group2") order by date desc
>> >
>> >
>> > --
>> >
>> > Thanks and regards
>> >
>> > Pankaj
>>

Mime
View raw message