My case: pageable and filtering (querydsl) of nested object (ObjectB - not unique).
Simplify data structure:
@Document(collection= "ObjectA")
class ObjectA {
String id;
List<ObjectB> list;
}
class ObjectB {
String name;
}
I can't use @DBRef because of other business decisions. I try to create another static collection called ObjectBView and update it using MongoListener. Unfortunately, this solution cause a lot of additional code and stun process.
@Document(collection= "ObjectBView")
class ObjectBView {
String objectAId;
String name;
}
I wonder how to use MongoDB View (not materialized) to create ObjectBView. I found out that it possible in dynamic way using MongoDatabase.createView() and query pages (mongoTemplate and PageableExecutionUtils). Unfortunately, I can't find way to combine it with QueryDSL to filtering data (currently use in project). QUeryDSL need static repository extended by QuerydslPredicateExecutor<T>.
Is any solution to create ObjectBView, automatically update properties from ObjectA and ObjectB and make it pageable as wel as filtering(QueryDSL)?