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 4f6501f140
commit 67b1fe5fbc

View File

@@ -1687,7 +1687,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