title: Recurring Events Schema w/ MongoDB
body: <p>I've read some of the papers out there describing data storing methods for recurring events, but I'm still trying to wrap my head around the best practice, especially concerning MongoDB.</p>
  
  <p>My main concern is to cheaply retrieve all of the events that occur within a given timeframe. My secondary concern is to modify and alter single occurrences without taking the entire event chain out of whack. </p>
  
  <p>Looking at others who have asked similar questions, I have come up with a possibility. I'm not completely sold on it, and would love some pointers in the right direction.</p>
  
  <p>My Idea: Within each Event document, have...</p>
  
  <ul>
  <li>a recurring string field that closely matches the iCal standard</li>
  <li>an "occurrences" embedded document or array field that contains changes/edit on specific occurrences (such as changing the description or start time, or canceling a single occurence).</li>
  <li>an occurrence start and end field to define easily queried boundaries of the recurrence rule</li>
  </ul>
  
  <p>Pros:</p>
  
  <ul>
  <li>able to store changes and still maintain association to other events</li>
  <li>easily queried, my model on the business side would have to construct each event though</li>
  </ul>
  
  <p>Cons/Potential Problems:</p>
  
  <ul>
  <li>if editing an event, and a user decides to mark changes as applying to "all events" - how to keep events that have already past from being altered</li>
  </ul>