{"version":"1.0","type":"rich","title":"Notify socket.io users when MongoDB data collection changes","description":"This example shows how MongoDB data changes are streamed to connected Socket.io users in real time. It uses the MongoDB `User.watch()` change stream to monitor collection modifications, and on each change, queries all users via `User.find({})` before emitting the updated dataset through `socket.emit('users', data)`. The code integrates with an Express app and a Socket.io server, logging connection events and collection changes to the console. No visualization library is involved; the focus is on the backend data pipeline that pushes fresh data to clients.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-4da7740b1d5cad474317016d8fc0da32?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}