Skip to content

Commit

Permalink
MARP-1455 Fix infinite product fetching (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
nntthuy-axonivy authored Nov 19, 2024
1 parent f488ade commit bfc6224
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,15 @@ public List<Product> findAllProductsHaveDocument() {
}

private Page<Product> getResultAsPageable(Pageable pageable, Criteria criteria) {
int skip = (int) pageable.getOffset();
int limit = pageable.getPageSize();
Aggregation aggregation = Aggregation.newAggregation(
Aggregation.match(criteria),
Aggregation.lookup(MongoDBConstants.PRODUCT_MARKETPLACE_COLLECTION, MongoDBConstants.ID, MongoDBConstants.ID,
MongoDBConstants.MARKETPLACE_DATA),
Aggregation.sort(pageable.getSort())
Aggregation.sort(pageable.getSort()),
Aggregation.skip(skip),
Aggregation.limit(limit)
);

List<Product> entities = mongoTemplate.aggregate(aggregation, MongoDBConstants.PRODUCT_COLLECTION,
Expand Down

0 comments on commit bfc6224

Please sign in to comment.