I am trying to develop an application that will upload objects of different types into MONGO DB using REALM. For example, in the GIT code, I am trying to upload objects of the ITEM type and an object of the DOG type. If I only upload an object of type DOG or an object of type ITEM then the code works and uploads the object to MONGODB. But if I run my application and the initial object is of type Dog then I manage to upload the object to MONGODB, but if I change the object from DOG to ITEM and try to upload an object of type ITEM to MONGODB (meaning now I changed the object from DOG to ITEM) I get the following error:
Realms.Exceptions.RealmException: ‘Cannot write to class Dog when no flexible sync subscription has been created.’
That is, the error occurs when I try to replace the object that I want to upload to MONGODB while the application is running.
I am adding my git repo :