How to send an automated email to users using MongoDB Atlas Triggers when a collection has NOT been updated in a specific time frame

Viewed 150

I can't find much information on this online so I hope someone can point me in the right direction.

I have a 'users' collection in MongoDB Atlas, it contains basic information on each user such as name, email, etc.

The 'users' collection also contains a field titled 'streaks' which is an array within the 'users' collection that records the dates where a user has logged into their account. When a user registers or logs into their account this date gets added to their 'streaks' array.

What I would like to do is set a scheduled email at a specific time to be sent to all users where todays date is NOT contained within their 'streaks' array using Triggers in MongoDB.

Or if there are any better ways in which to implement this functionality I am open to suggestions! I am using Node js, Express, MongoDB Atlas, Mongoose, React & Redux if this helps.

I can see plenty of information in regards to how to implement this sort of functionality if there's been an update/insert/delete made within a collection but nothing on how to implement this functionality if there has been no activity.

Apologise if this isn't very clear, thank you in advance!

0 Answers
Related