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

_document_registry can't handle two mongoengine.Document classes with same name different collection #1778

Closed
Cediddi opened this issue Apr 19, 2018 · 0 comments · Fixed by #2861

Comments

@Cediddi
Copy link

Cediddi commented Apr 19, 2018

I have a medium sized application with multiple modules. Two of the modules define similar classes with different collections defined. While class names are same, because the collection names differed, I id not encountered any error. Today I tried to use GenericReferenceField and experienced an error. That was because _document_registry only keeps class names, not the class path. I can think two solutions here.

1- Register by class paths.
2- Throw errors when trying to register a different class with same name.

For backwards compatibility you might do something like this:

  • Register by path, if path is already registered for another class, throw error
  • Register by name, if name is already registered, just ignore and override
  • Have a setting to totally disable "register by name" workflow.

These are my two cents.

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 a pull request may close this issue.

1 participant