Skip to content

Commit 3434e2a

Browse files
committed
repl#1 total count added
1 parent 0cd4247 commit 3434e2a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/scala/org/repl/poc/lmsdata/service/BookService.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ class BookService @Autowired() (mongoTemplate: MongoTemplate, bookRepository: Bo
4343
paginatedDto.results = results.getMappedResults.asScala.map( x => x.createDto() )
4444
paginatedDto.pageNum = requestDto.pageNum
4545
paginatedDto.pageSize = requestDto.pageSize
46-
paginatedDto.totalCount = 0
47-
46+
val aggTotal = newAggregation(
47+
`match`(filterCriteria)
48+
)
49+
val allResults: AggregationResults[BookMdl] = mongoTemplate.aggregate(aggTotal,"Book",classOf[BookMdl])
50+
paginatedDto.totalCount = allResults.getMappedResults.size()
4851
response.data = Some(paginatedDto)
4952
response.success = true
5053
return response

0 commit comments

Comments
 (0)