Skip to content

Instantly share code, notes, and snippets.

@xaxxon
Created May 27, 2015 09:28
Show Gist options
  • Save xaxxon/99c30dec4b9017643911 to your computer and use it in GitHub Desktop.
Save xaxxon/99c30dec4b9017643911 to your computer and use it in GitHub Desktop.
Meteor.setInterval (->
# console.log "Checking for old chats #{moment().subtract 10, 'seconds'}"
# Delete stored chat elements older than threshold
# meteor:PRIMARY> db.rooms.update({}, {$pull: {"chat":{date: {$lt: 1432208317490}}}})
room_collection.update {},
$pull:
chat:
date:
$lt: moment().subtract(10, "seconds").valueOf(),
{multi: true}
(error)-> console.log error if error
), 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment