-
Notifications
You must be signed in to change notification settings - Fork 88
(DOCSP-26981): @realm/reactify - Change an Object Model - React Native #2399
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-26981): @realm/reactify - Change an Object Model - React Native #2399
Conversation
Readability for Commit Hash: 019253c You can see any previous Readability scores (if they exist) by looking Flesch Reading Ease scores for changed documents:
The following table can be helpful in assessing the readability score of a document.
|
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
// :snippet-start: add-a-property-to-schema | ||
// :replace-start: { | ||
// "terms": { | ||
// "MyPerson": "Person" |
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.
[q] Why is this replace needed?
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.
There's already a Person schema with different properties used elsewhere in the unit test suite.
<react-native-schema-version>` ``1`` has a ``Person`` object type with a | ||
``firstName``, and ``lastName`` property. The developer decides to add an | ||
``age`` property to the ``Person`` class. | ||
|
||
To migrate the realm to conform to the updated ``Person`` schema, the | ||
developer sets the realm's :ref:`schema version <react-native-schema-version>` to | ||
``2``. | ||
developer sets the realm's schema version in the ``RealmConfiguration`` to ``2``. | ||
Finally, the developer passes the configuration object to the | ||
``createRealmContext()`` method. |
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 refer to user as 'the developer' here reads weird to me, and goes against the mongoDB style guide, which advocates 2nd person and imperative mood - https://www.mongodb.com/docs/meta/style-guide/writing/write-to-the-user/
could you refactor these sentences with this in mind?
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 think we're very inconsistent with using "developer" vs "user" throughout our docs, here are just a few examples of where we use developer (Update a Realm Object Schema - Flutter SDK, Change an Object Model - Swift SDK, Modify an Object Schema - Node.js SDK).
It's an easy enough change for me to make "developer" -> "user" if you feel particularly strongly about it, but I do think we might prefer to use "developer" for the following reasons:
- Main reason: "User" is ambiguous. Does this refer to the user using the application, or the user of realm (i.e the application developer), or the reader of this docs page (who may be one of many personas) ?
- Supplementary reason: To highlight that this is a specific example of how change the schema. Using the word "developer" indicates that someone else is doing this, not that this is the only way to do it. The
Also, it seems like the mongoDB style guide is specifically advocating not to use the phrase "the user".
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.
ok, but i was commenting that it should be changed to 2nd person ('you') or imperative, not 'user', so i think the initial comment still stands.
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.
Got it, altered to 'you' instead now.
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
examples/react-native/__tests__/js/realm-database/change-an-object-model-test.jsx
Outdated
Show resolved
Hide resolved
examples/react-native/__tests__/js/realm-database/change-an-object-model-test.jsx
Outdated
Show resolved
Hide resolved
examples/react-native/__tests__/ts/realm-database/change-an-object-model-test.tsx
Show resolved
Hide resolved
examples/react-native/__tests__/js/realm-database/change-an-object-model-test.jsx
Outdated
Show resolved
Hide resolved
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.
nice work! just couple of small things.
source/sdk/react-native/realm-database/change-an-object-model.txt
Outdated
Show resolved
Hide resolved
``2`` and defines a migration function to convert the ``Object ID`` type to a | ||
``string`` type. | ||
To migrate the realm to conform to the updated ``Task`` schema, the developer | ||
creates a :js-sdk:`Configuration <Realm.html#~Configuration>` object and |
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] don't make this a link b/c you link to this just a few lines above
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.
looking better, just a few things remaining
To migrate the realm to conform to the updated ``Person`` schema, the | ||
developer sets the realm's :ref:`schema version <react-native-schema-version>` to | ||
``2``. | ||
developer sets the realm's schema version in the ``Configuration`` to ``2``. |
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.
change to imperative/2nd person
developer sets the realm's :ref:`schema version <react-native-schema-version>` to | ||
``2``. | ||
developer sets the realm's schema version in the ``Configuration`` to ``2``. | ||
Finally, you pass the configuration object to the |
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.
Finally, you pass the configuration object to the | |
Finally, pass the configuration object to the |
To migrate the realm to conform to the updated ``Person`` schema, the | ||
developer sets the realm's schema version to 2 in the ``Configuration`` |
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 migrate the realm to conform to the updated ``Person`` schema, the | |
developer sets the realm's schema version to 2 in the ``Configuration`` | |
To migrate the realm to conform to the updated ``Person`` schema, | |
set the realm's schema version to 2 in the ``Configuration`` |
|
||
To migrate the realm to conform to the updated ``Person`` schema, the | ||
developer sets the realm's schema version to 2 in the ``Configuration`` | ||
object. Finally, you pass the configuration object to the |
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.
object. Finally, you pass the configuration object to the | |
object. Finally, pass the configuration object to the |
developer sets the realm's :ref:`schema version <react-native-schema-version>` to | ||
``2`` and defines a migration function to set the value of ``fullName`` based | ||
on the existing ``firstName`` and ``lastName`` properties. | ||
To migrate the realm to conform to the updated ``Person`` schema, you create a :js-sdk:`Configuration <Realm.html#~Configuration>` 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.
To migrate the realm to conform to the updated ``Person`` schema, you create a :js-sdk:`Configuration <Realm.html#~Configuration>` object | |
To migrate the realm to conform to the updated ``Person`` schema, create a :js-sdk:`Configuration <Realm.html#~Configuration>` object |
To migrate the realm to conform to the updated ``Person`` schema, you create a :js-sdk:`Configuration <Realm.html#~Configuration>` object | ||
and set the realm's schema version to ``2``, and define a migration function that | ||
sets the value of ``fullName`` based on the existing ``firstName`` and ``lastName`` | ||
properties. Finally, you pass the configuration object to the |
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.
properties. Finally, you pass the configuration object to the | |
properties. Finally, pass the configuration object to the |
developer sets the realm's :ref:`schema version <react-native-schema-version>` to | ||
``2`` and defines a migration function to convert the ``Object ID`` type to a | ||
``string`` type. | ||
To migrate the realm to conform to the updated ``Task`` schema, you create 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.
To migrate the realm to conform to the updated ``Task`` schema, you create a | |
To migrate the realm to conform to the updated ``Task`` schema, create a |
To migrate the realm to conform to the updated ``Task`` schema, you create a | ||
``Configuration`` object and set the realm's schema version to ``2``, and | ||
define a migration function to convert the integer type to an ``Object ID`` | ||
type. Finally, you pass the configuration object to the |
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.
type. Finally, you pass the configuration object to the | |
type. Finally, pass the configuration object to the |
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. some small suggestions about the 2nd person/imperative throughout
#2399) ## Pull Request Info ### Jira - https://jira.mongodb.org/browse/DOCSP-26981 ### Staged Changes - [Change an Object Model - React Native](https://docs-mongodbcom-staging.corp.mongodb.com/realm/docsworker-xlarge/DOCSP-26981-Change-A-ROM/sdk/react-native/realm-database/change-an-object-model/) ### Reminder Checklist If your PR modifies the docs, you might need to also update some corresponding pages. Check if completed or N/A. - [N/A] Create Jira ticket for corresponding docs-app-services update(s), if any - [N/A] Checked/updated Admin API - [N/A] Checked/updated CLI reference ### Review Guidelines [REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md) Co-authored-by: Mohammad Hunan Chughtai <[email protected]> Co-authored-by: Ben Perlmutter <[email protected]>
#2399) ## Pull Request Info ### Jira - https://jira.mongodb.org/browse/DOCSP-26981 ### Staged Changes - [Change an Object Model - React Native](https://docs-mongodbcom-staging.corp.mongodb.com/realm/docsworker-xlarge/DOCSP-26981-Change-A-ROM/sdk/react-native/realm-database/change-an-object-model/) ### Reminder Checklist If your PR modifies the docs, you might need to also update some corresponding pages. Check if completed or N/A. - [N/A] Create Jira ticket for corresponding docs-app-services update(s), if any - [N/A] Checked/updated Admin API - [N/A] Checked/updated CLI reference ### Review Guidelines [REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md) Co-authored-by: Mohammad Hunan Chughtai <[email protected]> Co-authored-by: Ben Perlmutter <[email protected]>
Pull Request Info
Jira
Staged Changes
Reminder Checklist
If your PR modifies the docs, you might need to also update some corresponding
pages. Check if completed or N/A.
Review Guidelines
REVIEWING.md