I also attempted to update an existing object in the Database that was synced from iOS Client containing an non-existent value for an optional key.
In the Collection that value was Null.
await collection.updateOne(
{ _id: ... },
{ $set: { parentId: newID }},
{ session });
// the object I am updating here contains a key
// { name: null }
it failed stating the the value that was already non existent (NULL in record) needed to be Undefined. But it was Null. (again, the NULL value was set by the sync client form the SDK or Realm server)
Expected: undefined, given: null
it looks like the validation mechanism that runs when updating a value is different that the one during a sync operation in the backend