couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <m...@hahnca.com>
Subject Re: Multiple key value query
Date Fri, 30 Nov 2012 01:47:13 GMT
>  Another easy, but very straightforward way would be to do query 3 times

I had a lot of trouble when switching from sql to nosql feeling guilty
when doing multiple requests.  I've gotten over that now.  Doing 3
fast simple requests is little to no worse than doing an sql query.
This assumes a local DB which is all I've used so far.

On Thu, Nov 29, 2012 at 5:33 PM, Andrey Kuprianov
<andrey.kouprianov@gmail.com> wrote:
> HI Bill,
>
> That would be very difficult to do in one shot. You are basically looking
> for a way to use multiple startkey-endkey pairs, which is not yet available
> in CouchDB.
>
> Easiest way would be to install Lucene or ElasticSearch on top of CouchDB (
> http://wiki.apache.org/couchdb/Full_text_search). That will widen your
> querying capabilities big time. Another easy, but very straightforward way
> would be to do query 3 times for each location and then combine results
> programmatically.
>
>   Andrey
>
>
>
>
> On Fri, Nov 30, 2012 at 1:56 AM, Bill <bill.foshay@noteandgo.com> wrote:
>
>> Hi,
>>
>> I'm newer to couchdb and having some trouble figuring out how to do a query
>> with multiple key values, including a date range. I have a map function
>> like
>> the following
>>
>> function(doc) {
>>   if(doc.type == "Article") {
>>     emit([doc.location, doc.release_date], doc)
>>   }
>> }
>>
>> I'm wondering if it's possible to do a query similar to either of the
>> following
>> sql queries
>>
>> select * from myView
>> where location in ('MD', 'NY', 'VA') and
>> release_date > '2012-11-01' and release_date < '2012-12-01'
>>
>> OR
>>
>> select * from myView
>> where (location='MD' or location='NY' or location='VA') and
>> (release_date > '2012-11-01' and release_date < '2012-12-01')
>>
>> Thanks for any help you can provide!
>>
>> Bill
>>
>>

Mime
View raw message