couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Bardubitzki <step...@bardubitzki.com>
Subject Re: Need some advice
Date Fri, 27 Apr 2012 21:06:31 GMT
Thanks for your suggestions Jim.

Unfortunately, I have to count out GeoCouch for now and your first 
suggestion doesn't satisfy my requirements. It would yield the events 
for a particular day, but not for all following days, requiring more 
connections to the db which I want to avoid for a mobile app.

Before posting I have tried a couple days to find a clean solution, but 
came up with the start_date as key. It gives me all events, including 
past events, and the hard work has to be done on client side.

My finding works, just have the feeling there is a more efficient way.

Stephan


On 12-04-27 11:38 AM, Jim Klo wrote:
> There's a whole bunch of ways to do that... but here are 2:
>
> 1. create a map function that emits all the days of the event as keys 
> - the searching for any particular day would yield those events
> 2. use geocouch, store the start & end dates as a box, then you can 
> use the current date as a bbox to find all events that overlap. Using 
> this method, you'd want to store time as an integer value and not a 
> string.
>
> IMHO #2 is probably a cleaner approach, but requires GeoCouch.
>
> - Jim
>
> *
> *
> *
> *Jim Klo*
> Senior Software Engineer
> Center for Software Engineering
> SRI International
> *
> *
> *
>
> On Apr 27, 2012, at 11:19 AM, Stephan Bardubitzki wrote:
>
>> I have a database of events and since events can be multi-day events 
>> all documents have a start_date and end_date. Now I want to get all 
>> events that happen today and those that are starting in the coming days.
>>
>> How should I determine if today is in the range of start_date and 
>> end_date?
>>
>> To make things more complex an event can be assigned to one or more 
>> categories such as sports, music etc. So the next task would be to 
>> get all events of a certain category that happen today and in the 
>> coming days.
>>
>> Since a db of events might be a common task I hope someone has 
>> already come up with a solution.
>>
>> Any advice would be greatly appreciated.
>>
>> Stephan
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message