I am making use of org.springframework.data.mongodb.core.query.Query, with Pageable for all the regular search and pagination related feature. It is working fine, now i wanted to join multiple collections and do the pagination operations. Is there any provision for the same?
Thanks!
UPDATE Please find the method which am using for achieving the same:
public <E> Page<E> searchEntity(final SearchCriteria searchCriteria, Pageable pageable, Class<E> entityClass) {
Query query = prepareSearch(searchCriteria); // method which frames the required search criteria based on the requests
long count = mongoOps.count(query, entityClass);
if (count == 0) {
return new PageImpl<>(new ArrayList<>(), pageable, 0);
}
query.with(pageable);
List<E> list = mongoOps.find(query, entityClass);
return new PageImpl<>(list, pageable, count);
}