Realm collection "update" not firing iOS notification

I’m running the ‘tracker’ tutorial app with mongoDB and an iOS client. Per the tutorial code I’m listening for notifications on the “Task” collection:

    tasks = realm.objects(Task.self).sorted(byKeyPath: "_id")
    notificationToken = tasks.observe { [weak self] (changes) in

When I add or delete a “Task” entity in the linked mongoDB Atlas cluster, the notification fires as expected and my table view updates.

However when I modify the property of a “Task” entity (for example, its name) in Atlas and save the changes, nothing happens i.e. the notification does not fire. Is this expected? (When I reload the table view the data refreshes however it’s not the “live” update I expect)

@Jeff_Sorrentino This is a known issue with Atlas Collection viewer - it translates an update into a delete and insert instead of an update. If you instead use the mongodb update command, the update notification will fire -
https://docs.mongodb.com/manual/tutorial/update-documents/

We are working on fixing this

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.