fancy
fancy

Reputation: 51383

What is the best way to know the last time a MongoDB doc was changed?

Do I need to tack on a lastActivity: new Date() @set every time I interact with it or is there a better way?

Upvotes: 0

Views: 73

Answers (1)

Derick
Derick

Reputation: 36774

MongoDB currently doesn't have built-in functionality to set the last-updated date, so you have to do that yourself indeed. I would probably (depending on language) inherit the MongoCollection class to add a thin wrapper around this to do it myself.

Upvotes: 2

Related Questions