Realm - Kotlin SDK
Realm is a reactive, object-oriented, cross-platform, mobile database:
Reactive: query the current state of data and subscribe to state changes like the result of a query, or even changes to a single object.
Object-oriented: organizes data as objects, rather than rows, documents, or columns.
Cross-platform: use the same database on iOS, Android, Linux, macOS, or Windows. Just define a schema for each SDK you use.
Mobile: designed for the low-power, battery-sensitive, real-time environment of a mobile device.
Realm is a cross-platform and mobile-optimized alternative to other mobile databases such as SQLite, Core Data, and Room.
You can also synchronize data between Realm and MongoDB Atlas using Atlas Device Sync. To learn more about using Realm with Device Sync, refer to Device Sync - Kotlin SDK.
Realm supports the following popular database features.
Schemas
Every realm object has a schema. That schema is defined via a native object in your SDK's language. Object schemas can include embedded lists and relations between object instances. To learn more, refer to Define a Realm Object Model.
Each realm uses a versioned schema. When that schema changes, you must define a migration to move object data between schema versions. Non-breaking schema changes, also referred to as additive schema changes, happen automatically. However, your SDK may require you to increase the local schema version to begin using the updated schema in your app. Breaking schema changes, also called destructive schema changes, require a migration function.
To learn more about schema versioning and migrations, refer to Change an Object Model.
Persistent or In-Memory Realms
You can use Realm to store data persistently on disk, or ephemerally in memory. Ephemeral realms can be useful in situations where you don't need to persist data between application instances, such as when a user works in a temporary workspace.
To learn more, refer to Configure and Open a Realm.
Queries
You can query Realm using platform-native queries or a raw query language that works across platforms.
To learn more about querying Realm, refer to Read & Write Data.
Encryption
Realm supports on-device realm encryption. Since memory mapping does not support encryption, encrypted realms use a simulated in-library form of memory mapping instead.
To learn more, refer to Encrypt a Realm.
Indexes
Indexes are implemented as trees containing values of a given property instead of a unique internal object key. This means that indexes only support one column, and thus only one property, at a time.
To learn more, refer to Index Properties.