Help with proper usage

I have recently got Realm integrated in my open-source project and it basically works, but I am having some problems getting it to work well.

First, it’s nice to have my own object types directly in the DB. But an issue is I can’t change the objects without getting into a write block, and since various properties need to be changed frequently, it’s not convenient to always get a write block to change a thing here and there, plus things changed in the write block aren’t automatically sync’ed with the in-memory copies of the objects. So, I chose to always get unmanaged objects by copyFromRealm and work with them, and then do copyToRealm on the objects at proper time to store them in the DB.

This seemed to work out fine until I found relationships in the unmanaged objects don’t get properly updated and I have to do lots of DB read based on change events elsewhere to update the relationships in the local objects. That makes the app cumbersome and less efficient.

So I would like to have advice on how to best use Realm considering the above needs.

Hello @X_Jia

I am not a MongoDB employee, but I have a few thoughts about your comment here.

I see you have posted a few questions. One of them you answered by yourself; others you got some community support for; I think there are 2 questions left unanswered, one about Realm and one about Android.

Both the unanswered questions require a lot of understanding of your environment and code. That understanding is not expressed by your questions.

This is community support: MongoDB employees sometimes post, but as you yourself said, it’s not paid support: other users are supporting you and supporting each other.

If you can keep your questions very narrowly focused, and post formatted code that illustrates your problem, you are more likely to get an answer from the community.

1 Like