DEV Community

IoT-SaaS: Web App using ReactJS, MongoDB Atlas & Realm

TagorenathV on January 11, 2022

Overview of My Submission Nowadays, SaaS platforms & IoT devices are gaining popularity in a variety of use-cases. I built a prototy...
Collapse
 
longvd89 profile image
longvd89

Hi. I am building a iot project. I have a lists of pi with data sensor sub from mqtt topic. How I can update realtime data for each only a row in table when data sensor change. Thanks

Collapse
 
tagorenathv profile image
TagorenathV

sync all data to a timeseries collection lets say sensor_data initially from mqtt topic. For every scheduled time, perform aggregation on this sensor_data and write updated data to aggregated_sensor_data. We have upsert operation in mongo. take pi device id as key reference and apply upsert operation on aggregated_sensor_data. now, at any given time you will have updated value for pi devices in aggregated_sensor_data collection.

Benefits: Because raw data is in timeseries collection, you can mention expireSeconds. aggregated_data collection could be normal collection type and can use this for database triggers. (At the moment, we cant use timeseries collection for realm-database-triggers)

Collapse
 
longvd89 profile image
longvd89

I want to ask the solution on front end with react

Thread Thread
 
tagorenathv profile image
TagorenathV

From UI perspective we just give a json response to populate a chart. For fetching that value for a pid we need to use mongo aggregation pipeline. Please check this if it helps:
github.com/tagorenathv/iot-saas/bl...

Collapse
 
kondalajagan profile image
jagan reddy

Good project!

Collapse
 
tagorenathv profile image
TagorenathV

Thankyou.

Collapse
 
techbelle profile image
rachelle palmer

This is so rad. I had to forward it to our product manager for time series. :) Thanks for building!!!

-Rachelle, Product Lead for Developer Experience at MongoDB

Collapse
 
tagorenathv profile image
TagorenathV

Thankyou. Glad You liked project.

Collapse
 
skkhajamohiddin96 profile image
SkKhajaMohiddin96 • Edited

This submission could be a startup itself ! Nice Project

Collapse
 
tagorenathv profile image
TagorenathV

Thankyou.

Collapse
 
josethz00 profile image
José Thomaz

Hi, very nice project congratulations! I have a question, how are you doing to monitor the devices? Are you connecting to he devices through MQTT and getting its data and then storing in the database?