Answer the question
In order to leave comments, you need to log in
How to know in mongodb that certain data has changed?
How to know in mongodb that certain data has changed?
Answer the question
In order to leave comments, you need to log in
In mongo, since version 3.6. there is such a thing as Change Streams . The bottom line is that you in the code, after connecting to the database, subscribe to data changes in a special way. For example, if you want to track changes in the Books collection:
const collection = db.collection('Books');
const changeStream = collection.watch();
changeStream.on('change', event => {
// event — см. типы событий: https://docs.mongodb.com/manual/reference/change-events/
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question