DEV Community

Shivam
Shivam

Posted on

Event emails reminder using Mongo DB Atlas

Overview of My Submission

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.

Working

1.The events are stored in documents. Each event has keys: description, time, processed, emailId.

Image description

Index is used to make query process fast
db. remindersList.createIndex({ processed: 1, date: 1 })

2.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.

Image description

3.The event occurrence, email is fired to email id (in emailId field) with description (in description field). For sending email, I am using 3rd party dependency SendGrid.

Image description

4.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}})

Submission Category:

Choose Your Own Adventure

Atlas services used:

  1. Atlas Database
  2. Realm Triggers
  3. Realm Functions

Link to Code

GitHub logo shivamarora1 / mongodb-realm

Email Reminder Service Mongo DB Realm application

Additional Resources / Info

Discussion (0)