-
Notifications
You must be signed in to change notification settings - Fork 23
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-45330: inheritance #66
base: standardized
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for docs-mongoid ready!
To edit notification comments on pull requests, go to your Netlify site 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.
Nice work ✨ LGTM with a few grammar nits and suggestions.
{+odm+} models. Inheritance allows you to apply the characteristics of | ||
one "parent" class to one or more "child" classes. | ||
|
||
{+odm+} supports inheritance in top level and embedded documents. |
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.
{+odm+} supports inheritance in top level and embedded documents. | |
{+odm+} supports inheritance in top-level and embedded documents. |
instances of ``Person``, ``Employee``, or ``Manager`` are all saved in the | ||
``people`` collection. {+odm+} sets the ``_type`` discriminator field to |
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.
[s] Suggestion for active voice:
instances of ``Person``, ``Employee``, or ``Manager`` are all saved in the | |
``people`` collection. {+odm+} sets the ``_type`` discriminator field to | |
{+odm} saves instances of ``Person``, ``Employee``, or ``Manager`` in the | |
``people`` collection. {+odm+} sets the ``_type`` discriminator field to |
~~~~~~~~~~~~~~ | ||
|
||
When you query on a child model class, the query returns only documents | ||
in which the value of the ``_type`` field match the queried class or |
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 which the value of the ``_type`` field match the queried class or | |
in which the value of the ``_type`` field matches the queried class or |
.. note:: | ||
|
||
Because the discriminator value customization is declared in child classes, | ||
you must load the child classes retrieved by a query *before* sending | ||
that query. In the preceding example, the ``Employee`` class definition | ||
must be loaded before you query on ``Person`` if the returned documents could | ||
potentially be instances of ``Employee``. Autoloading isn't able to resolve | ||
the discriminator value ``"Worker"`` to return the document as an | ||
instance of ``Employee``. |
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.
[s] Can potentially omit extra words for brevity and make this note easier to follow, for example:
.. note:: | |
Because the discriminator value customization is declared in child classes, | |
you must load the child classes retrieved by a query *before* sending | |
that query. In the preceding example, the ``Employee`` class definition | |
must be loaded before you query on ``Person`` if the returned documents could | |
potentially be instances of ``Employee``. Autoloading isn't able to resolve | |
the discriminator value ``"Worker"`` to return the document as an | |
instance of ``Employee``. | |
.. note:: | |
Because the discriminator value customization is declared in child classes, | |
you must load the child classes retrieved by a query *before* sending | |
that query. In the preceding example, the ``Employee`` class definition | |
must be loaded before you query on ``Person`` if the returned documents could | |
be instances of ``Employee``. Autoloading cannot resolve | |
the discriminator value ``"Worker"`` to return the document as an | |
instance of ``Employee``. |
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-45330
Staging - https://deploy-preview-66--docs-mongoid.netlify.app/data-modeling/inheritance/
Self-Review Checklist