Vinay Kumar

Leveraging MongoDB TTL

MongoDB has a convenient feature for automatically deleting documents after specified expiry time limit. This behavior can be made use of in scenarios like logging, session maintenance etc.

5 minutes after insertion the document holding the message "This is a log" will be removed automatically.