We’re using the Kotlin SDK in our Android app and in MongoDB we have a field that is a map/dictionary of Strings to Integer values. It has the following bson definition:
In the old Java SDK, there was a class called RealmDictionary that could represent such a data structure. Unfortunately, that doesn’t exist in the Kotlin SDK anymore.
What is the suggested way of representing this when using the Kotlin SDK?
I think you might be referring to the Java SDK form Realm. MongoDB has actually 2 different SDKs for accessing realm on the JVM:
The Java SDK is at version 10.11.1 and the Kotlin SDK is at version 1.1.0.
Due to some limitations of the Java SDK when it comes to multi-module setups we have to use the Kotlin SDK in our project. And that doesn’t have the RealmDictionary class anymore.
So I’m looking for ways to use maps/dictionaries when using the Kotlin SDK.
You’re right, we’re using realm-java. I feel like we should move to the Kotlin library, but if it doesn’t have RealmDictionary, that’ll prevent us from doing so for now.
Looking more. Frozen objects might change the entirety of how we use realm, so yeah, there’s that too. Anyway thanks for the insight.
Ok, my mistake, I was looking at the list of supported types here and failed to notice it being listed further in the article. Although I think it would be nice to add it to the list there as well.