     # Set our period timestamp on the document
     updateTimestamp = {}
     updateTimestamp[@timestamp] = timestamp
+    updateTimestamp[@expires] = expiry
 
     # Create or update the document
     @findAndModify

      all: 'all'
      events: 'events'
      timestamp: 'timestamp'

    # Initialize the document superclass
    super collection, mapping

  getId: (identifier, timestamp) ->
    timestamp = @getTimestamp timestamp
    "#{identifier}#{@options.id_mark}#{_pad timestamp, 15}"

  # Generates a random timestamp outside the document period to use for a TTL
  # index expiry timestamp
  getExpiry: (timestamp) ->
    day = 60 * 60 * 24
    week = day * 7
    # Generate a random offset between one day and a week
    offset = Math.random() * (week - day) + day
    moment.utc(timestamp).add -1 * offset, 'seconds'

  ###
  # Record events
