Skip to content

Change tracking for updates #57

Open
@bencrouse

Description

Is your feature request related to a problem? Please describe.
When saving an update to a model, the entire document is overwritten in the database, as opposed to only the fields that have changed, which could open you up to concurrency issues. Tracking changes can also be useful when implementing something like audit log.

Describe the solution you'd like
An update that only $sets the changed fields and a function API (e.g. model.HasChanged("FieldName")) to check what fields have changed in the hooks.

Describe alternatives you've considered
I'm not sure how this could implemented without changes to mgm, but open to ideas for sure!

Additional context
Would you all be open to a PR to add this if I put some work into it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions