How are multiple range queries performed in CouchDB? For a condition of one range, the combination of startkey and endkey works fine, but the same thing does not work with the condition of multiple ranges.
My view function looks like this:
"function(doc){
if ((doc['couchrest-type'] == 'Item')
&& doc['loan_name']&& doc['loan_period']&&
doc['loan_amount'])
{ emit([doc['template_id'],
doc['loan_name'],doc['loan_period'],
doc['loan_amount']],null);}}"
I need to get all documents using loan_period> 5 and
loan_amount> 30000. The parameters of the start and end keys are as follows:
params = {:startkey =>["7446567e45dc5155353736cb3d6041c0",nil,5,30000],
:endkey=>["7446567e45dc5155353736cb3d6041c0",{},{},{}],:include_docs => true}
Here I do not get the desired result. I think my startkey and endkey options are wrong. Can anybody help me?
Sanaldev
source
share