-
Notifications
You must be signed in to change notification settings - Fork 89
(DOCSP-39503): Consolidate Relationships page #3287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(DOCSP-39503): Consolidate Relationships page #3287
Conversation
Readability for Commit Hash: a9d25d6 You can see any previous Readability scores (if they exist) by looking Readability scores for changed documents:
For Grade Level, aim for 8 or below. For Reading Ease scores, aim for 60 or above:
For help improving readability, try Hemingway App. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, very good! A couple comments to aid in clarity.
implicitly "many-to-one" or "many-to-many." The only way to restrict a | ||
relationship to "one to one/one to many" instead of "many to one/many | ||
to many" is to use an :ref:`embedded object <sdks-embedded-objects>`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to many" is to use an :ref:`embedded object <sdks-embedded-objects>`, | |
to many" is to use an embedded object, |
Suggestion: Is it necessary to link to embedded objects twice within this intro?
come in, so querying a relationship is just as performant as reading a regular |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: I had to Google what 'lazily' meant. Is the technical detail necessary? Or perhaps reword to make clearer.
defines the relationship. The SDK executes read operations lazily as they | |
come in, so querying a relationship is just as performant as reading a regular | |
defines the relationship. Querying a relationship is just as performant as reading a regular |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazily is important, because it means the memory footprint of these relationships does not add substantially to the app's memory requirements until the objects are accessed. I think this is a term that developers will be familiar with, so I don't think it warrants additional explanation and I do think it's important to keep it here.
The SDK *does not* inherently limit object references from other | ||
objects within the same database. This means that SDK relationships are | ||
implicitly "many-to-one" or "many-to-many." The only way to restrict a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implicitly "many-to-one" or "many-to-many." The only way to restrict a | |
implicitly "many-to-one" or "many-to-many", so an object can be linked to any number of other objects in the database. The only way to restrict a |
Think the extra clarification would be helpful since this is the intro paragraph, and we haven't yet defined what a relationships like 'many-to-one' means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People who are looking for info about relationships are coming from a relational database. These terms are very common in relational databases and I don't think they need additional explanation here.
:ref:`an embedded object <sdks-embedded-objects>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused by this.
Is an embedded object considered to be in a to-one relationship with the parent object, and that's why it gets deleted? If so, I'm thinking this information might be best left for the embedded object page.
Or are you saying that it is possible for an embedded object to be in a to-one relationship with another object and in that case it will be deleted if set to null? If so, perhaps make this clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Embedded objects are a weird grey area. We don't explicitly define them as a relationship, because they're a different object type and they can't have a lifecycle outside of the parent object. They're not related - they're nested. So we don't say it's a related object - we say it's an embedded object. But we do say right above this:
The only way to restrict a relationship to "one to one/one to many" instead of "many to one/many to many" is to use an embedded object, which is a nested object with exactly one parent.
So - it felt important to call out here that embedded objects do get deleted, in case anyone takes that comment above as an implication that embedded objects behave like related objects.
object model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and sets are not associated with a query and are declared as a property of the | |
object model. | |
and sets are not associated with a query, meaning ... . They are declared as a property of the | |
object model. |
I'm not sure what it would mean that they are not associated with a query. Can you add a little bit more detail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In relational databases, it may be reasonable to infer that these collection types are transient and come from a query. It's important to distinguish for Realm/Device SDK, these aren't transient collections created by querying, but are defined properties on the model. This is also conceptual information that should be familiar to people who are coming from relational databases, so I don't think it warrants additional explanation here.
collection property in the parent object whose type is a | ||
``RealmList<E>``, ``RealmSet<E>``, or ``RealmDictionary<E>``, where | ||
``<E>`` is a ``RealmObject`` object type defined in your data model. | ||
This can be a different Realm object type or the same Realm object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a different Realm object type or the same Realm object | |
This can be a different object type or the same object |
Should Realm be deleted here or is it necessary to differentiate the object types from normal ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, relationships are specifically between Realm objects. I thought about saying "SDK" instead of "Realm" here, but since we have just enumerated the different object types and they are all Realm
object types, I thought it made sense to leave the Realm naming for clarity.
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Relationship definitions in Realm are unidirectional. An |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relationship definitions in Realm are unidirectional. An | |
Relationship definitions for Atlas Device SDK are unidirectional. An |
realm naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Only lingering question is that the Kotlin page includes how to make the different types of relationship for embedded objects. Is this specific to Kotlin and will this information be included in the embedded object section for Kotlin? @dacharyc
Link to Kotlin page: https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/realm-database/schemas/relationships/#define-an-embedded-object
Totally reasonable question, @lindseymoore ! In the consolidated docs set, the Embedded Object info is on the "Define an Object Model" page - you can see the details in this PR: #3314 Here's the section about Embedded Objects: https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39502/sdk/model-data/object-models/#define-an-embedded-object I removed the info from here because embedded objects aren't related objects in the same way as the other relationships here. They can't exist independent of their parent object. The relationships described here are about linking two object types that each have independent lifecycles. The concept info here does mention embedded objects and link out to the other page, but obviously the page content isn't populated here - it's in the PR for the consolidated "Define an Object Model" page. |
81be17c
into
mongodb:feature-consolidated-sdk-docs
✨ Staging URL: https://preview-mongodbmongodb.gatsbyjs.io/realm/feature-consolidated-sdk-docs/ 🪵 Logs |
Pull Request Info - SDK Docs Consolidation
Jira ticket: https://jira.mongodb.org/browse/DOCSP-39503
Staged Page
Page Source
Add links to every SDK's pages where you got the SDK-specific information:
PR Author Checklist
Before requesting a review for your PR, please check these items:
feature-consolidated-sdk-docs
branch instead ofmaster
Naming
.rst
files comply with the naming guidelinesLinks and Refs
Content
Reviewer Checklist
As a reviewer, please check these items: