The main aim of this project is to fire an email to the user with an appropriate description when the time of the particular event (set by the user prior) is up.
- The events are stored in documents. Each event has
keys
: description, time, processed, emailId.
Index is used to make query process fast
db. remindersList.createIndex({ processed: 1, date: 1 })
- The time (in
time
field) controls when the event will be fired. The scheduled trigger type is deployed which checks what event has been passed in regular intervals.
- The event occurrence, email is fired to email id (in
emailId
field) with description (indescription
field). For sending email, I am using 3rd party dependencySendGrid
.
- After the event is processed, the
processed
field is set true, so that event is not fired again.context.services.get("mongodb-atlas").db("reminders").collection("remindersList").updateOne({_id:id},{$set:{processed:true}})
Choose Your Own Adventure
Atlas Database
Realm Triggers
Realm Functions