Skip to content
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

Open
wants to merge 7 commits into
base: standardized
Choose a base branch
from

Conversation

rustagir
Copy link
Collaborator

@rustagir rustagir commented Nov 14, 2024

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

  • Is this free of any warnings or errors in the RST?
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?

Copy link

netlify bot commented Nov 14, 2024

Deploy Preview for docs-mongoid ready!

Name Link
🔨 Latest commit 253cc80
🔍 Latest deploy log https://app.netlify.com/sites/docs-mongoid/deploys/6737b2ca64505000081ef4a4
😎 Deploy Preview https://deploy-preview-66--docs-mongoid.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rustagir rustagir marked this pull request as ready for review November 15, 2024 20:34
Copy link

@stephmarie17 stephmarie17 left a 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.

Choose a reason for hiding this comment

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

Suggested change
{+odm+} supports inheritance in top level and embedded documents.
{+odm+} supports inheritance in top-level and embedded documents.

Comment on lines +48 to +49
instances of ``Person``, ``Employee``, or ``Manager`` are all saved in the
``people`` collection. {+odm+} sets the ``_type`` discriminator field to

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:

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

Choose a reason for hiding this comment

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

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

Comment on lines +189 to +197
.. 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``.

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:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants