Skip to content

Commit

Permalink
Add note to Relationships page
Browse files Browse the repository at this point in the history
  • Loading branch information
cbullinger committed Jul 31, 2023
1 parent 63919d9 commit d9cbf37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ class User: RealmObject {
@PrimaryKey
var _id: ObjectId = ObjectId()
var name: String = ""
var posts: RealmList<Post>? = realmListOf()
var posts: RealmList<Post> = realmListOf()
}
7 changes: 5 additions & 2 deletions source/sdk/kotlin/realm-database/schemas/relationships.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ To-Many Relationship
--------------------

A to-many relationship means that an object is related in a specific way
to multiple objects. You can create a relationship between one object
to multiple objects.

You can create a relationship between one object
and any number of objects using a field of type ``RealmList<T>`` where
``T`` is a Realm object in your application:
``T`` is a Realm object in your application. Note that lists or sets of
``RealmObject`` cannot have null elements.

.. literalinclude:: /examples/generated/kotlin/SchemaTest.snippet.to-many-relationship.kt
:language: kotlin
Expand Down

0 comments on commit d9cbf37

Please sign in to comment.