Docs Menu

Open a Realm - Kotlin SDK

On this page

  • Open a Realm
  • Close a Realm

To open a realm, create a RealmConfiguration with RealmConfiguration.Builder and pass the resulting RealmConfiguration to Realm.open():

val config = RealmConfiguration.Builder(setOf(Frog::class))
.build()
val realm = Realm.open(config)
Log.v("Successfully opened realm: ${realm.configuration.name}")

You can close a realm with realm.close(). The close() method blocks until all write transactions on the realm have completed.

realm.close()
←  Relationships - Kotlin SDKQuery Language - Kotlin SDK →
Give Feedback
© 2022 MongoDB, Inc.

About

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