Docs Menu

Optional Fields - Kotlin SDK

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
}
←  Index a Field - Kotlin SDKPrimary Keys - Kotlin SDK →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.