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

Object::set_property_value does not sync embedded objects correctly with CreatePolicy::UpdateAll

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      If an embedded object with an array gets updated via an SDK, like this:

      realmQuery.update({
        ...,
        update: {
          foo: {
            bar: {
              bizz: [ 1, 2 ]
            }
          }
        }
      });
      

      The object at bar will be replaced with a new embedded object with a new array, and the sync instructions will reflect that. However, there's nothing in the sync instructions to clear the object that was there previously. This leads to uploading corrupted changesets to the sync server with prior_sizes that look as though the embedded object was set to null and then re-created, even though there are no instructions to do that. If you select a CreatePolicy of CreatePolicy::UpdateModified, then the object bar will be diffed and the array values will get updated instead of inserted.

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            jonathan.reams@mongodb.com Jonathan Reams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: