micronaut-data icon indicating copy to clipboard operation
micronaut-data copied to clipboard

micronaut data mongo not updating/saving/listing nested collection

Open brucemelo opened this issue 1 year ago • 0 comments

Expected Behavior

micronaut data mongo should save/update/listing nested collection.collections

Actual Behaviour

I have a movie and nested movies, I want to update the nested and list all movies with nested, for example.

I've tried the same thing with spring data mongo and worked

mapping spring

@Document
public record Movie(
        @Id
        ObjectId id,
        String title,
        @DBRef
        Set<Movie> next
)  {
}

mapping micronaut

@Serdeable
@MappedEntity(value = "movies")
public record Movie(
        @Id
        @GeneratedValue
        ObjectId id,
        @Nullable
        String title,
        @Nullable
        @Relation(value = Relation.Kind.ONE_TO_MANY) //tried with mappedBy = "movies"
        Set<Movie> next
) {

}

Steps To Reproduce

repo https://github.com/brucemelo/micronaut-mongo-issue

Environment Information

macos java 21

Example Application

https://github.com/brucemelo/micronaut-mongo-issue

Version

micronautVersion=4.7.3

brucemelo avatar Dec 27 '24 17:12 brucemelo