Hi,
What is the best way to design an audit trail log for update and delete operations?
1 Collection -> 1 Audit trail collection or all collection -> 1 Audit trail collection?
Hi,
What is the best way to design an audit trail log for update and delete operations?
1 Collection -> 1 Audit trail collection or all collection -> 1 Audit trail collection?
The best way to audit MongoDB databases is with the enterprise audit features
https://docs.mongodb.com/manual/core/auditing/
A simpler approach can be using application code with change stream or MongoDB Atlas triggers to be fired on every update delete recording what happened.
Thanks
Pavel
Does it also store the user id who edited or deleted the document?
Auditing does gather users that performed an operation and you can filter on the actual operation:
Having said that, be aware that auditing might add some overhead to overall database activity so we do not recommend tracking a high volume operation if its not obsoletely necessary.
Pavel
We are making an HRIS system in which we need to log all changes that happened on an employee’s data.