Skip to content

(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

Merged
merged 5 commits into from
Jul 12, 2024

Conversation

dacharyc
Copy link
Collaborator

@dacharyc dacharyc commented Jun 6, 2024

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:

  • Open the PR against the feature-consolidated-sdk-docs branch instead of master
  • Tag the consolidated page for:
    • genre
    • meta.keywords
    • meta.description

Naming

Links and Refs

  • Create new consolidated SDK ref targets starting with "_sdks-" for relevant sections
  • Remove or update any SDK-specific refs to use the new consolidated SDK ref targets
  • Update any Kotlin API links to use the new Kotlin SDK roles

Content

  • Shared code boxes have snippets or placeholders for all 9 languages
  • API description sections have API details or a generic placeholder for all 9 languages
  • Check related pages for relevant content to include
  • Create a ticket for missing examples in each relevant SDK: Consolidation Gaps epic

Reviewer Checklist

As a reviewer, please check these items:

  • Shared code example boxes contain language-specific snippets or placeholders for every language
  • API reference details contain working API reference links or generic content
  • Realm naming/language has been updated
  • All relevant content from individual SDK pages is present on the consolidated page

Copy link

github-actions bot commented Jun 6, 2024

Readability for Commit Hash: a9d25d6

You can see any previous Readability scores (if they exist) by looking
at the comment's history.

Readability scores for changed documents:

  • source/sdk/model-data/relationships: Grade Level: 11.1, Reading Ease: 45.66

For Grade Level, aim for 8 or below.

For Reading Ease scores, aim for 60 or above:

Score Difficulty
90-100 Very Easy
80-89 Easy
70-79 Fairly Easy
60-69 Medium
50-59 Fairly Hard
30-49 Hard
0-29 Very Hard

For help improving readability, try Hemingway App.

@dacharyc dacharyc marked this pull request as ready for review June 6, 2024 19:08
@dacharyc dacharyc added the merge to feature branch Unreleased feature - do not merge to Master label Jun 7, 2024
Copy link
Collaborator

@lindseymoore lindseymoore left a 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>`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Comment on lines +41 to +42
come in, so querying a relationship is just as performant as reading a regular
Copy link
Collaborator

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.

Suggested change
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

Copy link
Collaborator Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Collaborator Author

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.

Comment on lines +70 to +71
:ref:`an embedded object <sdks-embedded-objects>`.
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Comment on lines +93 to +94
object model.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Copy link
Collaborator Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Copy link
Collaborator Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Relationship definitions in Realm are unidirectional. An
Relationship definitions for Atlas Device SDK are unidirectional. An

realm naming

Copy link
Collaborator

@lindseymoore lindseymoore left a 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

@dacharyc
Copy link
Collaborator Author

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.

@dacharyc dacharyc merged commit 81be17c into mongodb:feature-consolidated-sdk-docs Jul 12, 2024
6 checks passed
@dacharyc dacharyc deleted the DOCSP-39503 branch July 12, 2024 21:16
@docs-builder-bot
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge to feature branch Unreleased feature - do not merge to Master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants