Im using triggers as a way to audit actions on my collections.
I recently noticed a weird behaviour regarding to the changeEvent object.
Im getting the updated fields (on update operation) from changeEvent.updateDescription.updatedFields.
It usually works as expected, but only on the first update of the document, Im getting extra data in updatedFields that did not get updated, specifically elements inside an array of objects.
Thanks for clarifying the environment and MongoDB version I assume you’ve created a Database Trigger for this since it’s on Atlas but please correct me if i’m wrong here.
Would you be able to provide the specific update command used?
Additonally, I noticed the childrens field containing objects with the name field present in the updatedFields value you provided but not in the original example document. Is this part of the update or was this supposed to be age instead of name?
As we are using orm in our app (prisma) the update does include the whole document (and its a bit complicated), however, I did check and the update command is basically the same except the field that I’m updating (and updatedAt that we have), so there should not be a difference between the first update and the rest of them.