From 29e52579ce5b6f42eaf2918941e0c94a084c5cc1 Mon Sep 17 00:00:00 2001 From: blu10ph Date: Thu, 10 Feb 2022 14:55:47 +0800 Subject: [PATCH] Do not get sorting configuration repeatedly When calling the mapReduce method, when the operation determines whether there is a sorting operation, the sorting configuration will be obtained. When setting the MapReduce sorting configuration, if there is repeated acquisition, it is modified to use the obtained sorting configuration. --- .../org/springframework/data/mongodb/core/MongoTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java index 93477b738e..456c440eec 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java @@ -1849,7 +1849,7 @@ public List mapReduce(Query query, Class domainType, String inputColle Document mappedSort = getMappedSortObject(query, domainType); if (mappedSort != null && !mappedSort.isEmpty()) { - mapReduce = mapReduce.sort(getMappedSortObject(query, domainType)); + mapReduce = mapReduce.sort(mappedSort); } mapReduce = mapReduce