T
T
TipoImya2021-01-19 16:15:46
MongoDB
TipoImya, 2021-01-19 16:15:46

You need to track data changes in MongoDB, but how?

I have a bot in discord, and let's imagine such a situation that let's say someone gave someone a balance, and the user's balance in the database has changed.
In the database, for example, the user had 120 balance, and after the change it became 180, how can I track which field has changed, and what was the value in this field before?

I searched the MongoDB documentation and only found this . After reading everything, and following the example by writing a small code - I decided to test it. After changing the document in the database, the already changed document was displayed to me in the console, with a new value in the field. Tried to google, but unfortunately without success.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question