I understand the question and just a couple of general thoughts. There are two issues as work.
The first being that Realm notification events fire after the write has been committed so there is no ‘prior data’ available at that point.
The second is the timing. If this is the objective
ultimately in the end, what I want to achieve is a logic to reject a document update if certain conditions are not met
rejecting it within that notification is the wrong place to do it - if you want to deny a change or delete, it should be done way before that time.
Much of this occurs asynchronously so you don’t want to be caught in a race condition when determining if data should be altered.
Imagine a multi-user To Do list where one of the To Do’s is ‘locked’ so other users don’t delete it. When another user attempts the delete, you don’t want to wait for a notification or event to occur, the code should check to see if the locked property is set, and when the result of that test asynchronously returns, either approve or deny the request.
That being said, if you really want to do handle it in a notification fashion, you could craft some type of soft delete. For example, add a property ‘status’ and when a user want to delete something set it to ‘delete’ The observer will catch that in an event, see the status is set to ‘delete’ perform your check and if it passes, then perform the actual delete, ensuring you don’t fire another event.