Learn more about the Realm SDKs 10.0 Release on our Developer Hub HERE
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.
- [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.
- 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.
- 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)
- 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.