Open frynet opened 1 year ago
Try adding this annotation @Join("bananas")
on FruitRepoV1
@MongoRepository
@Join("bananas")
interface FruitRepoV1 : CrudRepository<FruitV1, String>
(or findById method) so when FruitV1
object is loaded from the db it will fetch mapped collection bananas
(if that is your actual issue here)
Try adding this annotation
@Join("bananas")
onFruitRepoV1
@MongoRepository @Join("bananas") interface FruitRepoV1 : CrudRepository<FruitV1, String>
(or findById method) so when
FruitV1
object is loaded from the db it will fetch mapped collectionbananas
(if that is your actual issue here)
Still getting null
:(
I think the reporter wants to use DBRef
mongo type to store the association internally. Right now, we have just a simple object with an id field. We would need to come up with a way to store it differently, maybe it can be stored with DBRef
when the relationship is annotated with @BsonRepresentation(BsonType.DB_POINTER)
Right, I saw example using relation mapping and was not sure if they wanted to use collection mapping that can be done in Micronaut since DBRef is not supported in Micronaut Data mongoDB. Sorry for adding confusion.
Expected Behavior
That's what I want to see:
Actual Behaviour
I've tried to declare data entities for my mongo db and all I got is a
null
in a nested (via reference) collection.That's what I got (in all 3 cases)
Steps To Reproduce
go to my repository and follow the instructions
Environment Information
Example Application
https://github.com/frynet/MicronautFailedMappingMongoNestedEntities
Version
3.7.3