Realm v10.0.0 Release Notes

Release Date: 2020-10-15 // over 3 years ago
  • ๐Ÿš€ NOTE: This is a unified release note covering all v10.0.0-BETA.X v10.0.0-RC.X releases.

    ๐Ÿ”€ NOTE: Support for syncing with realm.cloud.io and/or Realm Object Server has been replaced with support for syncing with MongoDB Realm Cloud.

    โฌ‡๏ธ NOTE: This version upgrades the Realm file format to version 20. It is not possible to downgrade to earlier versions than v10.0.0-BETA.7. Non-sync Realms will be upgraded automatically. Synced Realms can only be automatically upgraded if created with Realm Java v10.0.0-BETA.1 and above.

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ‘€ [RealmApp] Most APIs for interacting with Realm Cloud have changed significantly. All new APIs can be found in the io.realm.mongodb package. The entry point is through the App class from which you can create and login users and otherwise interact with MongoDB Realm. See the docs for further details. Synced Realms still use a SyncConfiguration that are largely created the same way.
    • ๐Ÿ— [RealmApp] Client Resets are now handled through a custom SyncConfiguration.Builder.clientResetHandler() instead of through the default session error handler SyncConfiguration.Builder.errorHandler()
    • [RealmApp] Realm files have changed location on disk. They are now located in getFiles()/mongodb-realm.
    • [RealmApp] All synced model classes not marked as embedded are required to have a primary key named _id. It is possible to use @RealmField(name = "_id") to map from any Java or Kotlin property.
    • ๐Ÿ— From now on it is by default not allowed to run transactions with either Realm.executeTransaction() or DynamicRealm.executeTransaction() from the UI thread. Doing so will yield a RealmException. Users can override this behavior by using RealmConfiguration.Builder.allowWritesOnUiThread(true) when building a RealmConfiguration to obtain a Realm or DynamicRealm instance, however, we do not recommend doing so. Instead, we recommend using executeTransactionAsync() or, alternatively, using non-UI threads when calling executeTransaction() for both Realms and DynamicRealms.

    โœจ Enhancements

    • ๐Ÿ— Users can now opt out from allowing queries to be launched from the UI thread by using RealmConfiguration.Builder.allowQueriesOnUiThread(false). A RealmException will be thrown when calling RealmQuery.findAll(), RealmQuery.findFirst(), RealmQuery.minimumDate(), RealmQuery.maximumDate(), RealmQuery.count(), RealmQuery.sum(), RealmQuery.max(), RealmQuery.min(), RealmQuery.average() and RealmQuery.averageDecimal128() from the UI thread after having used allowQueriesOnUiThread(false). Queries will be allowed from the thread from which the Realm instance was obtained as it always has been by default, although we recommend using RealmQuery.findAllAsync() or RealmQuery.findFirstAsync(), or, alternatively, using a non-UI thread to launch them.
    • 0๏ธโƒฃ BaseRealm.refresh() will throw a RealmException if it is being called from the UI thread if allowQueriesOnUiThread is set to false, though it will be allowed by default.
    • โž• Added DynamicRealm.executeTransactionAsync().
    • โž• Added Kotlin extension suspend function Realm.executeTransactionAwait() which runs transactions inside coroutines.
    • โž• Added Kotlin extension function RealmResults.toFlow() which returns a Kotlin flow, similar to our RxJava convenience method asFlowable().
    • โž• Added Kotlin extension function RealmList.toFlow() which returns a Kotlin flow, similar to our RxJava convenience method asFlowable().
    • โž• Added Kotlin extension function RealmModel.toFlow() which returns a Kotlin flow, similar to our RxJava convenience method asFlowable().
    • RealmLists can now be marked final. (Issue #6892)
    • โž• Added support for distinct queries on non-index and linked fields. (Issue #1906)
    • โž• Added support for org.bson.types.Decimal128 and org.bson.types.ObjectId as supported fields in model classes.
    • โž• Added support for org.bson.types.ObjectId as a primary key.
    • โž• Added support for "Embedded Objects". They are enabled using @RealmClass(embedded = true). An embedded object must have exactly one parent object linking to it and it will be deleted when the parent is. Embedded objects can also be the parent of other embedded classes. Read more here. (Issue #6713)

    ๐Ÿ›  Fixes

    • None.

    Compatibility

    • โฌ†๏ธ File format: Generates Realms with format v20. Unsynced Realms will be upgraded from Realm Java 2.0 and later. Synced Realms can only be read and upgraded if created with Realm Java v10.0.0-BETA.1.
    • ๐Ÿš€ APIs are backwards compatible with all previous release of realm-java in the 10.x.y series.
    • Realm Studio 10.0.0 or above is required to open Realms created by this version.

    Internal

    • โšก๏ธ Updated to Realm Sync: 10.0.0.
    • โšก๏ธ Updated to Realm Core: 10.0.0.