Home > OS >  How can I watch for changes to a specific object in a Mongo DB collection?
How can I watch for changes to a specific object in a Mongo DB collection?

Time:01-05

I want to look for changes for a specific object in mongo db that I can then use socket io to post to the client. I found a lot of ways to watch a whole collection for changes but watching a whole collection isn't what I need as I only need the client who created a object to be able to know when that specific object updates.

CodePudding user response:

It looks like you can accomplish this with something called Change Streams.

From the docs: https://docs.mongodb.com/drivers/node/current/usage-examples/changeStream/

  •  Tags:  
  • Related