You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And also another entity InboxEvent that has a field called feedEvent, polymorphic, holding subtypes of FeedEvent as @Embedded.
Morphia automagically creates another index here like { feedEvent.actor.actorObject.userId, feedEvent.actor.actorType } which is nice...
BUT it doesn't seem to be handling the partial filter expression correctly, this is, it's creating this automatic index by prepending feedEvent to the fields of the original index but it's not doing the same for the field paths in the partial filter expression so the index is wrong.
If I try to set the index manually in InboxEvent Mongo will complain saying that there's already an index with the same keys but different options.
So the workaround is to remove the original index in FeedEvent and create both manually with the driver.
The text was updated successfully, but these errors were encountered:
I'm going to try to recreate your problem based on what's here but if you could provide me with the index you think you should have, I'll try to get to the bottom of this. Thanks.
OK. I think i have recreated this sufficiently and see what you're talking about. I'm going to dig in to see what it'd take to correct this but, fair warning, i was planning on deprecating the index generation based on @Embedded types in 2.0. Finding nested index definitions and automatically creating indexes on the parent type is error prone and not always desirable. Indexes are about queryability and not all embedded types are meant to be queried. Better to explicitly declare on the top level types what indexes to used on those collections and not overallocate indexes that will never be used but still must be maintained by the server.
At any rate, I'll see if there's something that can be done in the meantime.
If I have en entity
FeedEvent
with an index such asAnd also another entity
InboxEvent
that has a field calledfeedEvent
, polymorphic, holding subtypes ofFeedEvent
as@Embedded
.Morphia automagically creates another index here like
{ feedEvent.actor.actorObject.userId, feedEvent.actor.actorType }
which is nice...BUT it doesn't seem to be handling the partial filter expression correctly, this is, it's creating this automatic index by prepending
feedEvent
to the fields of the original index but it's not doing the same for the field paths in the partial filter expression so the index is wrong.If I try to set the index manually in
InboxEvent
Mongo will complain saying that there's already an index with the same keys but different options.So the workaround is to remove the original index in
FeedEvent
and create both manually with the driver.The text was updated successfully, but these errors were encountered: