Skip to content

DOCSP-50489: EmbeddedModelArrayField support #37

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

Conversation

norareidy
Copy link
Collaborator

@norareidy norareidy commented Jun 5, 2025

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-50489

Staging Links

  • limitations-upcoming
  • model-data/models
  • 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 Jun 5, 2025

    Deploy Preview for docs-django ready!

    Name Link
    🔨 Latest commit 9374e2e
    🔍 Latest deploy log https://app.netlify.com/projects/docs-django/deploys/684347e85410260008a124a8
    😎 Deploy Preview https://deploy-preview-37--docs-django.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 project configuration.

    @rustagir rustagir self-requested a review June 5, 2025 17:33
    Copy link

    @rustagir rustagir left a comment

    Choose a reason for hiding this comment

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

    lgtm, left a small clarifying comment

    Comment on lines 461 to 464
    You can use an ``EmbeddedModelArrayField`` to represent a MongoDB ``Object``
    that stores an array of document values. Each document in the array corresponds
    to a {+django-odm+} ``EmbeddedModelField`` value. To create an ``EmbeddedModelArrayField``,
    use the ``EmbeddedModelArrayField()`` class constructor and pass the following arguments:
    Copy link

    Choose a reason for hiding this comment

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

    S: there might be confusion between document values and values that are documents
    I.e.

    • document values of {hello: "world"} -> "world"
    • values that are documents - [{hello: "world"}, {goodbye: "sun"}]
    Suggested change
    You can use an ``EmbeddedModelArrayField`` to represent a MongoDB ``Object``
    that stores an array of document values. Each document in the array corresponds
    to a {+django-odm+} ``EmbeddedModelField`` value. To create an ``EmbeddedModelArrayField``,
    use the ``EmbeddedModelArrayField()`` class constructor and pass the following arguments:
    You can use an ``EmbeddedModelArrayField`` to represent a MongoDB ``Object``
    that stores an array of documents. Each document in the array corresponds
    to a {+django-odm+} ``EmbeddedModelField`` value. To create an ``EmbeddedModelArrayField``,
    use the ``EmbeddedModelArrayField()`` class constructor and pass the following arguments:

    Use an EmbeddedModelArrayField
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    You can use an ``EmbeddedModelArrayField`` to represent a MongoDB ``Object``
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    Nit: In the Mongo parlance, isn't an "object" typically called a "document" and if so an EmbeddedModelArrayField could also be called a "document of documents" ?

    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 I think document is the better word, changed

    Copy link
    Collaborator

    @aclark4life aclark4life left a comment

    Choose a reason for hiding this comment

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

    LGTM!

    Just to confirm my understanding,

    • EmbeddedModelField can contain a single EmbeddedModel instance e.g. Award and as such, it's similar to a one to one relationship in SQL.
    • EmbeddedModelArrayField can contain one or more EmbeddedModel instances and as such, it's similar to a one to many relationship in SQL.

    @norareidy norareidy merged commit 8a0692b into mongodb:master Jun 6, 2025
    5 checks passed
    @norareidy norareidy deleted the DOCSP-50489-embeddedmodelarrayfield branch June 6, 2025 20:12
    norareidy added a commit that referenced this pull request Jun 6, 2025
    * DOCSP-50489: EmbeddedModelArrayField support
    
    * edit limitations
    
    * edits
    
    * RR feedback
    
    * AC feedback
    
    (cherry picked from commit 8a0692b)
    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.

    3 participants