Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-953

Access to deleted ObjectIds from collection listener callback

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • Q4-23FY
    • Affects Version/s: None
    • Component/s: None

      Describe your problem or use case

      We are currently implementing a cache of object accessors in realm-js that we want be able to prune on modification or deletion events, keyed by the object_id. Currently when I register a listener to a collection, I get a change set containing the indexes that were changed. In the case of deletions, it is not possible to determine what objects were deleted.

      Describe the solution you'd like

      I have two possible solutions:

      1. Include {{object_id}}s in the changeSet given to the callback
      2. Provide a frozen collection to the callback that shows a snapshot of the collection before the changes depicted in the changeSet.

      Additional context

      I think variation 1 would be easier to implement, but variation 2 would offer the possibility of having more logic in the listener callbacks, such as comparing the old collections verses the new and performing some action based on that.

            Assignee:
            jorgen.edelbo@mongodb.com Jørgen Edelbo
            Reporter:
            andrew.meyer@mongodb.com Andrew Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: