Skip to content

Commit

Permalink
(DOCSP-27332): Regenerating Kotlin Open a Realm code (#2479)
Browse files Browse the repository at this point in the history
## Pull Request Info
Regenerated the `open-a-realm` snippet and added small blurb about using
`RealmConfiguration.create()` (per [Kotlin Sync Feedback Document
changes](#2405 (comment))
PR)

### Jira

- https://jira.mongodb.org/browse/DOCSP-27332

### Staged Changes

- [Kotlin Quick Start: Open a
Realm](https://docs-mongodbcom-staging.corp.mongodb.com/realm/docsworker-xlarge/docsp-27332-open-realm-fix/sdk/kotlin/quick-start/#open-a-realm)

### Reminder Checklist

If your PR modifies the docs, you might need to also update some
corresponding
pages. Check if completed or N/A.

- [x] Create Jira ticket for corresponding docs-app-services update(s),
if any
- [x] Checked/updated Admin API
- [x] Checked/updated CLI reference

### Review Guidelines


[REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md)
  • Loading branch information
cbullinger authored Jan 11, 2023
1 parent ff145d4 commit 6f874a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,16 @@ class QuickStartTest: RealmTest() {


// :snippet-start: quick-start-open-a-local-realm
// :uncomment-start:
// val config = RealmConfiguration.create(schema = setOf(Item::class))
// val realm: Realm = Realm.open(config)
// :uncomment-end:
// :remove-start:
val config = RealmConfiguration.Builder(schema = setOf(Item::class))
// :remove-start:
.directory("/tmp/")
.name(getRandom())
// :remove-end:
.build()
// :remove-end:
val realm: Realm = Realm.open(config)
// :remove-start:
// insert some sample data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
val config = RealmConfiguration.create(schema = setOf(Item::class))
.build()
val realm: Realm = Realm.open(config)
15 changes: 9 additions & 6 deletions source/sdk/kotlin/quick-start.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,21 @@ that represents Todo items in a Todo list app.
Open a Realm
------------

Use `RealmConfiguration
<{+kotlin-local-prefix+}io.realm.kotlin/-realm-configuration/index.html>`__
to control the specifics of the realm you
would like to open, including the name, location, and schema.
Pass your configuration to the `Realm factory constructor
<{+kotlin-local-prefix+}io.realm.kotlin/-realm/-companion/open.html>`__
Use
`RealmConfiguration.create() <{+kotlin-local-prefix+}io.realm.kotlin/-realm-configuration/-companion/create.html>`__
to open a realm using default parameters. Pass your configuration to the
`Realm factory constructor <{+kotlin-local-prefix+}io.realm.kotlin/-realm/-companion/open.html>`__
to generate an instance of that realm:

.. literalinclude:: /examples/generated/kotlin/QuickStartTest.snippet.quick-start-open-a-local-realm.kt
:language: kotlin
:copyable: false

For more information on how to control the specifics of the
`RealmConfiguration <{+kotlin-local-prefix+}io.realm.kotlin/-realm-configuration/index.html>`__
you would like to open (e.g. name, location, schema version), refer to
:ref:`Open & Close a Realm <kotlin-open-a-realm>`.

Create, Read, Update, and Delete Objects
----------------------------------------

Expand Down

0 comments on commit 6f874a5

Please sign in to comment.