Evaluating Realm DB, need help

Hi there. So I am evaluating Realm for a new project. Right now I am testing its write speed on a mobile device. I am having trouble with it however. The issue is that after I write to disk and then fetch all the items I just wrote, the count is mismatched. I am writing 10k objects to the realm. After the write I am getting all the items in said realm and getting the count. The count always comes back as 1k instead of 10k. I think this is because of how I am getting the data. I am making an API call to our backend to get 1k objects. I then multiply thats items by 10 and store that in another collection. I iterate through all 10k items and change their ID to a random GUID so that each item in the 10k is unique. I then write all 10k items to disk and then get all the items back. But the count is always off. Can anyone help me understand why this is?

Which SDK are you using? And if you can post how you write and read the data it would be easier to figure out what could be wrong.

1 Like

Hey Christan, I actually figured out the cause of the problem right after posting. The problem was that I was copying the 1k objects into the larger collection, then when changing the ID to a GUID, it did it for all 10 copies of that object in the large collection. To fix the problem I preform a Clone on each object so that I am not referencing the same object multiple times. This can be closed out, thanks.

1 Like

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