Docs Menu

Docs HomeRealm

Optional Fields - Kotlin SDK

To mark a field as optional, use the built-in ? Kotlin operator:

class Knight : RealmObject {
val _id: ObjectId = ObjectId()
val name: String = ""
val mount: Horse? = null
}
←  Index a Field - Kotlin SDKPrimary Keys - Kotlin SDK →
Share Feedback
© 2023 MongoDB, Inc.

About

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