Skip to content

INTPYTHON-698 Add EmbeddedFieldIndex and EmbeddedFieldUniqueConstraint - #376

Merged
timgraham merged 1 commit into
mongodb:mainfrom
WaVEV:INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model
Feb 1, 2026
Merged

timgraham merged 1 commit into
mongodb:mainfrom
WaVEV:INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model

Conversation

@WaVEV

@WaVEV WaVEV commented Aug 25, 2025 •

Copy link
Copy Markdown
Collaborator

No description provided.

@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from 998a080 to 5dd116b Compare August 25, 2025 03:05
Comment thread django_mongodb_backend/schema.py Resolved
Comment thread django_mongodb_backend/lookups.py Resolved
@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from 3e722d1 to 2010776 Compare August 25, 2025 23:16
@timgraham timgraham changed the title Intpython 698 define indexes on embedded models in top level model INTPYTHON-698 Allow defining embedded model indexes on the top-level model Aug 26, 2025
@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch 6 times, most recently from 86aed5e to 9636c17 Compare September 6, 2025 03:34
@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from 9636c17 to e1c98f3 Compare September 6, 2025 19:33
@WaVEV
WaVEV marked this pull request as ready for review September 6, 2025 19:40
Jibola

This comment was marked as outdated.

@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from e1c98f3 to eb29e72 Compare October 11, 2025 15:19
@timgraham

Copy link
Copy Markdown
Contributor

Concurrent with the release of this, will we stop support unique constraints and indexes declared on embedded models and their fields? Or perhaps we should try to put that through a deprecation process?

@aclark4life

Copy link
Copy Markdown
Collaborator

Probably should be deprecated in case anyone is using them.

@Jibola

Jibola commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

Concurrent with the release of this, will we stop support unique constraints and indexes declared on embedded models and their fields? Or perhaps we should try to put that through a deprecation process?

We should put this in a deprecation process. For the first bump where this change occurs, we'll let them know that the deprecation is coming.

@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from eb29e72 to c0707cc Compare October 30, 2025 00:08
@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch 3 times, most recently from d40c24a to 9c56be4 Compare November 3, 2025 01:38
@WaVEV WaVEV closed this Nov 3, 2025
@WaVEV
WaVEV deleted the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch November 3, 2025 01:49
@WaVEV
WaVEV restored the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch November 3, 2025 02:18
@WaVEV WaVEV reopened this Nov 3, 2025
@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch 4 times, most recently from 1c28e45 to d9c04dc Compare November 9, 2025 21:04
Comment thread django_mongodb_backend/indexes.py Resolved
Comment thread django_mongodb_backend/indexes.py Resolved
Comment thread django_mongodb_backend/indexes.py Resolved
Comment thread django_mongodb_backend/indexes.py Resolved
@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from 3e4b51f to 9cfc1dc Compare January 7, 2026 00:33
Comment thread django_mongodb_backend/indexes.py Resolved
Comment thread django_mongodb_backend/indexes.py Resolved
Comment thread django_mongodb_backend/schema.py Resolved
@timgraham
timgraham dismissed Jibola’s stale review January 13, 2026 18:15

removing stale approval

@WaVEV
WaVEV force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from 5742b99 to 16416bb Compare January 18, 2026 18:11
Comment thread django_mongodb_backend/schema.py Resolved
Comment thread django_mongodb_backend/indexes.py Resolved
@timgraham
timgraham force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from 815fa45 to 17cb927 Compare January 24, 2026 01:51
Comment thread docs/topics/embedded-models.rst Resolved
Comment thread docs/topics/embedded-models.rst Outdated
Comment on lines +67 to +68
Indexing ``EmbeddedModelField``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need some explanation of if/how this functionality works on the other embedded field variants (array, polymorphic).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I haven't considered that 😬 , EMAF is an easy win. Shall we also allow to index over non shared fields in polymorphic?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Maybe we have to open a new ticket for polymorphic. they aren't very complicated but is a bit out of scope.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Also, do we need mention how it won't work on polymorphics? because, an exception will be raised or a check's error if the user wants to create an index on that kind of field. And in the docs we only present the indexing of EMF and EMAF no more.

Comment thread django_mongodb_backend/indexes.py Resolved
Comment thread django_mongodb_backend/indexes.py Resolved
Comment thread django_mongodb_backend/indexes.py Resolved
@timgraham
timgraham force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from a3b164b to bca2685 Compare January 28, 2026 16:25
@timgraham
timgraham force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch 4 times, most recently from c6b2885 to 56175ff Compare January 31, 2026 02:49
Comment thread django_mongodb_backend/constraints.py Resolved
@timgraham timgraham changed the title INTPYTHON-698 Allow defining embedded model indexes on the top-level model INTPYTHON-698 Add EmbeddedFieldIndex and EmbeddedFieldUniqueConstraint Jan 31, 2026
Co-authored-by: Tim Graham <timograham@gmail.com>
@timgraham
timgraham force-pushed the INTPYTHON-698-Define-indexes-on-Embedded-Models-in-Top-Level-Model branch from 1a290e8 to fefbaa1 Compare January 31, 2026 23:29
@timgraham
timgraham merged commit fefbaa1 into mongodb:main Feb 1, 2026
20 checks passed

This branch was previously deployed

1 inactive deployment
release — fefbaa1e Deployed Feb 2, 2026 by blink1073 via post-publish #414
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.

5 participants