Skip to content

Commit 67b1fe5

Browse files
blu10phchristophstrobl
authored andcommitted
Avoid obtaining mapped sort multiple times for mapReduce.
Apply already mapped sort for map reduce instead of running the source document through the mapping layer again. Closes: #3960
1 parent 4f6501f commit 67b1fe5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ public <T> List<T> mapReduce(Query query, Class<?> domainType, String inputColle
16871687

16881688
Document mappedSort = getMappedSortObject(query, domainType);
16891689
if (mappedSort != null && !mappedSort.isEmpty()) {
1690-
mapReduce = mapReduce.sort(getMappedSortObject(query, domainType));
1690+
mapReduce = mapReduce.sort(mappedSort);
16911691
}
16921692

16931693
mapReduce = mapReduce

0 commit comments

Comments
 (0)