incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wout Mertens <>
Subject Re: [user] Filtering with a pattern
Date Tue, 03 Mar 2009 15:44:57 GMT
I think in this case you'll have to create a view for each property  
that you want to filter on first.

So if you want to first filter on temperature and then on endurance, I  
would emit [23.4,5,"Fe"]. I think though that "Fe" might be the  
actualy value so you might instead be emitting [23.4,5],"Fe".

You can then query for startkey=[20,0]&endkey=[24,9999] and it would  
give you all elements with temperatures between 20 and 24 and all  
their endurances.


On Mar 3, 2009, at 3:29 PM, Manolo Padron Martinez wrote:

> Hi again:
> Another newbie question.
> I have some docs in this form:
> {
>  "Temperature":23.4,
>  "Endurance":5,
>  "Element":"Fe"
> }
> I would like to make a view that show all the docs that have some X
> temperature, an endurance between Y and Z values and a W element.  
> But the
> ranged value could be any of the properties (or all properties)
> I thought If I make a map function that emit an array of this kind (
> ["Temperature",23.4],["Endurance",5],["Element","Fe]]  )   for every
> document I could filter it with startkey and endkey, but doesn't  
> work as I
> wish.
> Anyone knows how can I make a view that let me filter in that way?
> Thanks in advance
> Regards from Canary Islands
> Manuel Padron Martinez

View raw message