I am working on a feature where the admin creates a course and the user gets notified. I am thinking of using MongoDB change stream but I need sockets to send the changed data to the frontend.
Now the scenario: Admin creates a course, change stream notifies and the socket.io emits that to the frontend.
My question is, if we are using socket.io to send the data to the frontend then why do we need MongoDB change stream? What we can do is simply emit the event when admin success in creating a course.
I have gone through multiple articles and they are doing the same- calling an API to create and update the document, a change stream to watch, and socket.io emit the event.
If we can send the data to the frontend once the course is created then why do we need MongoDB Change Stream?