Docs Home → MongoDB Realm
To mark a field as optional, use the built-in ? Kotlin operator:
?
class Knight: RealmObject { val _id: Long = Random.nextLong() val name: String = "" val mount: Horse? = null}