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
This commit is contained in:
blu10ph
2022-02-10 14:55:47 +08:00
committed by Christoph Strobl
parent badfbb50c1
commit 6cad96709d

View File

@@ -1848,7 +1848,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
Document mappedSort = getMappedSortObject(query, domainType);
if (mappedSort != null && !mappedSort.isEmpty()) {
mapReduce = mapReduce.sort(getMappedSortObject(query, domainType));
mapReduce = mapReduce.sort(mappedSort);
}
mapReduce = mapReduce