Ability to get previous values from change streams
Drew DiPalma
Hi Folks!
As part of our upcoming re-brand of "Stitch" to "Realm" we'll also be migrating our feedback forum and joining the rest of MongoDB at feedback.mongodb.com – as part of that transition, we'll be shutting down this forum. We're still keeping track of this feedback and all of the related comments/discussions, but have only migrated feedback with 5+ votes at this time. If you would like us to continue to track this item in the new forum please let us know.
Tyler Kaye
Unfortunately this is a limitation on MongoDB change streams which do not include this information for efficiency reasons. However, you do have access to the fullDocument field which should give you the state of the full document after the change.
F!
Tyler Kaye: "After the change" meaning I won't be able to get the previous value. E.g. 'Kanye' was changed to 'Nas'. As of today, I get 'Nas' but can I also see that 'Kanye' was the previous value?
Tyler Kaye
F!: Correct. Our watch() currently just uses MongoDB Change Streams under the hood which do not expose this information at this time. Im not sure what your use-case is, but Mobile Sync will handle these changes for you if you are using the iOS / Android platform.
F!
Tyler Kaye: My use case is an audit trail. So for update operations, it's important to know document both the previous values & current values of changed fields.