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.city,doc.expires],doc);
>> }
>>
>> and then you can get all offers for a certain city by querying with startkey
>> ["Moscow",Date()]
>>
>> 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.city,
> 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
> http://mysite.com/city/Moscow, 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()...
Wout.