Skip to content

Commit d4dc138

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 830fad9 commit d4dc138

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
@@ -1852,7 +1852,7 @@ public <T> List<T> mapReduce(Query query, Class<?> domainType, String inputColle
18521852

18531853
Document mappedSort = getMappedSortObject(query, domainType);
18541854
if (mappedSort != null && !mappedSort.isEmpty()) {
1855-
mapReduce = mapReduce.sort(getMappedSortObject(query, domainType));
1855+
mapReduce = mapReduce.sort(mappedSort);
18561856
}
18571857

18581858
mapReduce = mapReduce

0 commit comments

Comments
 (0)