
The application that you’ll be building allows you to add and delete tasks. In this tutorial, you’re going to learn how to stream, in realtime, the changes made to a collection in a MongoDB database to a React app using a Node.js server.

However, in MongoDB, change streams allows you to listen for changes in collections without any complexity.Ĭhange streams are available since MongoDB 3.6 and they work by reading the oplog, a capped collection where all the changes to the data are written and functions as the database replication log. Use the database transaction/replication log, which records every change to the database.Use database or application-level triggers to execute a piece of code when something changes.

Poll the database every X seconds and determine if something has changed using a timestamp, version number or status field.In a previous tutorial, I mentioned there are three main approaches to do this: Getting data changes from a database in realtime is not as easy as you may think. You should have some knowledge of Node and React, and a basic understanding of MongoDB management tasks.

You will need MongoDB 3.6+ and Node.js 6+ installed on your machine.
