-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watching changes #54
Comments
Hi, @markosole, you are right, it should work. I suppose you used the atomic method for updating that doesn't trigger events. |
Oh okey, I've used MongoDB Compas to update data. Does this watch changes in DB or service itself? I am having problem with "Listening to events on the Db class has been deplecated". I know it's not really related to this subject but relevant. This is my package dependecies list
I've found that there is "monk" problem with versions. Any idea how to fix this? |
Unfortunately, monk does not support the modern version of mongodb driver, we started removing monk but #49 is still in progress, I suppose I will continue to work on this PR in the near future. Watching on changes works only when using updatedOn method, because this method also makes a comparison between current and new documents, and emits 'updated' event. So it will not work if you will use Robo3T or MongoDB Atlas or atomic methods. We don't use Change Streams because it doesn't return the previous document. |
Thanks for clarification, I think I will switch to socket method with self made solution. |
Hi all,
I am wondering would this allow me to watch for for a changes (Event Handlers section) and trigger something?
I've setup simple query which works just fine, but event has never been triggered when data in DB is changed
userService.on('updated', ({ doc, prevDoc }) => { console.log("Here we go, change!")});
Would this supposed to work if I update any record?
Thanks!
The text was updated successfully, but these errors were encountered: