I am researching several ODMs for our project.
First of all: project documentation on this topic is really bad, also code documentation and comments are missing.
I have found hints at https://github.com/behackett/presentations/tree/master/pycon_2012 (which seems outdated) and in the unit tests.
I attach a pytest unit test which shows my assertions.
Problem: if I query a subclass for all instances with find
, I get also the instances from the superclass
Expectation: I get only those instances, which belong to my subclass
Problem: if I query one instance from the subclass with get
, I get the instance from the superclass
Expectation: I get the instance from the subclass
Generally it seems that I have always to add kind=<polymorphic_identity>
to get it right, but that would mean, that I have to take care of the inheritance chain and make as many queries as subclasses are defined. Such things I would expect the ODM to resolve.
Since the documentation is so sparse, it is also possible that I am totally wrong, so I ask you to point me in the right direction.
Anonymous
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Same problem here!
In my eyes, a query on a subclass should only return instances of this class and its subclasses
That's not strictly a bug as it's the currently documented behaviour ( http://ming.readthedocs.org/en/latest/polymorphism.html#querying-polymorphic-entities ) but I agree it would be a nice to have feature.