I need to capture the delta when user update a field from the mobile app and use this change via trigger and function for further business logic.
When I tried following scenarios, the change event was captured as “Replace” type:
- Update the document directly on MongoDB Web
- Using React-native SDK(10.4.1) for react native to update a document with embedded object
However, if I did the same thing via MongoDB compass, the change event is “Update” type.
May I know why there’s difference result in terms of change event? I expected all change type should be “Update” type.
After further investigation using React-native SDK, I found that only when we’re updating the root-level fields of the document, delta can be captured with change type “update”. Otherwise, if we update nested fields of the same document, mongo will treat it as a “replace” event and it couldn’t tell the delta.
Wonder this is a product limitation or is a bug?