Find Object by Primary Key - Kotlin SDK
To find an object with a specific primary key value, open a realm
and query the primary key field for the desired primary key value
using realm.query().
Specify the object type as a type parameter passed to query()
:
// Search equality on the primary key field name val frogs: Frog? = realm.query<Frog>("_id == $0", PRIMARY_KEY_VALUE).first().find()