couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail A. Pokidko" <>
Subject Re: searching for something like AND clause
Date Thu, 02 Sep 2010 11:57:17 GMT
On Thu, Sep 2, 2010 at 2:45 PM, Wout Mertens <> wrote:
> On Sep 2, 2010, at 12:32 , Mikhail A. Pokidko wrote:
>>> Since you want to filter on city AND date, you can do
>>> function(doc) {
>>>   doc.type == 'offer' && emit ([,doc.expires],doc);
>>> }
>>> and then you can get all offers for a certain city by querying with startkey
>>> Functions are untested and I'm a little rusty in Javascript so they may be wrong
but you get the idea :)
>> I`ve tried such combinations - version with emit([,
>> doc.expires],doc) i find a little bit clumsy :
>> http://localhost:5984/dbname/_design/design/_view/1/?startkey=[%22Moscow%22,%20%222010/08/31%22]&endkey=[%22Moscow%22,%20%222010/09/22%22]
>> - it would be difficult to wrap with rewrites to something like
>>, i mean date-key, not city-key.
>> So i thought there may be more elegant way.
> Isn't that what client-side javascript is for? Let that URL show you a formatted document
for Moscow and have it embed a list created from Moscow and the Date()...

Hm-hm..  At first i was going to prevent anybody being able to browse
expired offers (and with certain desire that is possible if javascript
sets date), but now i`m going to rethink this. Probably it could solve
my problem from that side.

xmpp: pma AT altlinux DOT org

View raw message