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 theApp
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 aSyncConfiguration
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 handlerSyncConfiguration.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()
orDynamicRealm.executeTransaction()
from the UI thread. Doing so will yield aRealmException
. Users can override this behavior by usingRealmConfiguration.Builder.allowWritesOnUiThread(true)
when building aRealmConfiguration
to obtain a Realm or DynamicRealm instance, however, we do not recommend doing so. Instead, we recommend usingexecuteTransactionAsync()
or, alternatively, using non-UI threads when callingexecuteTransaction()
for bothRealm
s andDynamicRealm
s.
โจ Enhancements
- ๐ Users can now opt out from allowing queries to be launched from the UI thread by using
RealmConfiguration.Builder.allowQueriesOnUiThread(false)
. ARealmException
will be thrown when callingRealmQuery.findAll()
,RealmQuery.findFirst()
,RealmQuery.minimumDate()
,RealmQuery.maximumDate()
,RealmQuery.count()
,RealmQuery.sum()
,RealmQuery.max()
,RealmQuery.min()
,RealmQuery.average()
andRealmQuery.averageDecimal128()
from the UI thread after having usedallowQueriesOnUiThread(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 usingRealmQuery.findAllAsync()
orRealmQuery.findFirstAsync()
, or, alternatively, using a non-UI thread to launch them. - 0๏ธโฃ
BaseRealm.refresh()
will throw aRealmException
if it is being called from the UI thread ifallowQueriesOnUiThread
is set tofalse
, 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 methodasFlowable()
. - โ Added Kotlin extension function
RealmList.toFlow()
which returns a Kotlin flow, similar to our RxJava convenience methodasFlowable()
. - โ Added Kotlin extension function
RealmModel.toFlow()
which returns a Kotlin flow, similar to our RxJava convenience methodasFlowable()
. - 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
andorg.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.
- ๐ [RealmApp] Most APIs for interacting with Realm Cloud have changed significantly. All new APIs can be found in the