title: How to expire data in Firebase Database
body: <p>I am building an "events" application, in which some users put some events in the application and other users see them. Let's say every event has a start datetime, end datetime and name.</p>
  
  <p>I would like the users to see only the current events, that is the events with start &lt; now &lt; end. This is some kind of filtering, which is not supported in Firebase. I can achieve this in my application with startAt and endAt queries. However, this will not help me to hide this confidential data from the users because, although my application won't access past and future events, anyone can query the database from its REST API to see these events.</p>
  
  <p>Therefore, I decided to structure the data with three lists of events: <code>past_events</code>, <code>current_events</code> and <code>future_events</code>.</p>
  
  <p>Now, the problem is that, I need to move the events from <code>future_events</code> to  <code>current_events</code> and from <code>current_events</code> to <code>past_events</code> when the time is right. I believe there is no way to trigger these changes automatically within firebase. Therefore, I am considering to put a service somewhere which periodically does this cleaning up.</p>
  
  <p>Is this the best way to handle data expiration in Firebase? Any suggestions/comments?</p>
  
  <p>Thanks</p>