title: How to create and store recurring calendar events in MongoDB
body: <p>I'm building a Calendar based application where there are events in a calendar. Events can be recurring (daily, weekly, monthly, quarterly, bi-annually and annually). </p>
  
  <p>Each event document has a default <code>name</code>, <code>defaultDate</code> and <code>description</code> but also contains an array (<code>userData</code>) of objects  that are associated with each user (<code>userDate</code>, <code>userDescription</code>). Although the events are centralised, some users have their own <code>userDate</code> which isn't the default and each user is able to set their own <code>userDescription</code> for the event. That's why the <code>userData</code> object exists.</p>
  
  <p>To clarify, the event document looks something like this:</p>
  
  <pre><code>{
      _id: '1234567',
      name: 'Event One',
      description: 'This is the default description',
      defaultDate: '2017-02-15T12:00:00.000Z',
      userData: [
          { 
              userId: '8765432',
              userDate: '2017-06-10T12:00:00.000Z',    
              userDescription: 'My personalised description',
          },
          { 
              userId: '461938',
              userDate: '2017-03-21T12:00:00.000Z',    
              userDescription: 'I have a description too!',
          },       
      ]
  }
  </code></pre>
  
  <p>I'm trying to work out the best way to handle storing recurrences of these events when they are created. When the event is edited it needs to edit all other  copies of the event too. There will never be a scenario where a single event needs to be edited but the recurrances are left untouched.</p>
  
  <p>When the events are created, I have a HTML select which asks if the event is recurring and has the following options: none, daily, weekly, monthly, quarterly, bi-annually, annually</p>
  
  <p>If anyone can advise the best way to create recurring copies of these events I would appreciate it!</p>