Skip to content

Application migration from version 1.3.2 to version 2.3.4 #2923

@dcdh

Description

@dcdh

Describe the bug
I am migrating an application using an old version of morphia to Quarkus.
I have notice a breaking change regarding the index validation on @reference property.
Before it was possible to référence them inside the index but now it is no more possible : a ValidationException is thrown instead.

To Reproduce
Steps to reproduce the behavior:

Have an entity with a property annotated with @reference
Reference the property inside @Index

Sample:

@Entity(value = "Child")
public class Child {
    @Id
    ObjectId id;
}

@Entity(value = "Parent")
@Indexes({
    @Index(fields = @Field(value = "child.$id"), options = @IndexOptions(disableValidation = true))
})
public class Parent {
    @Reference
    Child child;
}

The change has been made on the resolve method in PathTarget when it checks if an element is present and if the field is a reference. Line 175.
Does this behavior is expected ?
Maybe a check can be added if we want to validateNames or not ?

Expected behavior
Application should start.
Index should be created.

** Please complete the following information: **

  • Server Version: quarkus-morphia 0.5.0
  • Driver Version:
  • Morphia Version:

Additional context
Any example models, queries, and executable test cases you can supply will greatly help debugging your issue:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions