How to check for stale data for implementing a cache

Hi there!

I’m trying to implement a cache for my database (basically ensuring that data is fresher than a certain age and updating the db if it isn’t).

My question is:
How can I check the age of the records? Pretty much would be checking the of the last input in the db

This is the first time that I’m trying to implement something like this, so I’m not even sure if “cache” is the proper term, or if MongoDB is the right tool for the job, so please don’t hesitate to point any mistakes out

Thanks! :slight_smile: