Skip to content

Commit

Permalink
Merge pull request #172 from devgateway/feature/OCE-119/nopaginationf…
Browse files Browse the repository at this point in the history
…orlocation

OCE-119
  • Loading branch information
mpostelnicu authored Sep 22, 2016
2 parents f8ec694 + 047e2a3 commit 4e05beb
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ public List<DBObject> fundingByTenderDeliveryLocation(

Aggregation agg = newAggregation(
match(where("tender").exists(true).and("tender.tenderPeriod.startDate").exists(true)
.and("tender.value.amount").exists(true).andOperator(getDefaultFilterCriteria(filter))),
.andOperator(getDefaultFilterCriteria(filter))),
new CustomProjectionOperation(project), unwind("$tender.items"),
unwind("$tender.items.deliveryLocation"), match(
where("tender.items.deliveryLocation.geometry.coordinates.0").exists(true)),
group(Keys.YEAR, "tender." + Keys.ITEMS_DELIVERY_LOCATION).sum("$tender.value.amount")
.as(Keys.TOTAL_TENDERS_AMOUNT).count().as(Keys.TENDERS_COUNT),
sort(Direction.ASC, Keys.YEAR), skip(filter.getSkip()), limit(filter.getPageSize()));
sort(Direction.ASC, Keys.YEAR)
//,skip(filter.getSkip()), limit(filter.getPageSize())
);

AggregationResults<DBObject> results = mongoTemplate.aggregate(agg, "release", DBObject.class);
List<DBObject> tagCount = results.getMappedResults();
Expand Down Expand Up @@ -125,8 +127,9 @@ public List<DBObject> qualityFundingByTenderDeliveryLocation(
group(Fields.UNDERSCORE_ID_REF).max("tenderItemsDeliveryLocation").as("hasTenderItemsDeliverLocation"),
group().count().as("totalTendersWithStartDate").sum("hasTenderItemsDeliverLocation")
.as(Keys.TOTAL_TENDERS_WITH_START_DATE_AND_LOCATION),
new CustomProjectionOperation(project1), skip(filter.getSkip()),
limit(filter.getPageSize()));
new CustomProjectionOperation(project1)
//,skip(filter.getSkip()),limit(filter.getPageSize())
);

AggregationResults<DBObject> results = mongoTemplate.aggregate(agg, "release", DBObject.class);
List<DBObject> tagCount = results.getMappedResults();
Expand Down

0 comments on commit 4e05beb

Please sign in to comment.