Skip to content

Commit 39593a0

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 36e639f commit 39593a0

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

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

18551855
mapReduce = mapReduce

0 commit comments

Comments
 (0)