Skip to content

Commit 6cad967

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 badfbb5 commit 6cad967

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

18491849
Document mappedSort = getMappedSortObject(query, domainType);
18501850
if (mappedSort != null && !mappedSort.isEmpty()) {
1851-
mapReduce = mapReduce.sort(getMappedSortObject(query, domainType));
1851+
mapReduce = mapReduce.sort(mappedSort);
18521852
}
18531853

18541854
mapReduce = mapReduce

0 commit comments

Comments
 (0)