I built mongoose-history-audit to add an audit trail to applications that use MongoDB through Mongoose. It records field-level changes and carries the actor and execution channel through asynchronous code.
Sooner or later every project faces the same question: who changed this document, when, and what exactly? A support engineer asks why a user's tariff plan changed last Tuesday. A compliance officer asks for the history of edits to a contract. A developer debugs a bug that "the field was fine yesterday" β and needs to see every intermediate state.
There are several approaches to solving this problem:
Write audit code by hand in every service method β logChange(...) next to each updateOne . It works, but it is boilerplate, it is easy to forget, and it silently diverges as new endpoints appear.
Store a full document snapshot on every change. Complete, but heavy β most updates touch one or two fields, and you pay storage for the whole document each time.β¦