|
|
|
|
@ -15,17 +15,8 @@
@@ -15,17 +15,8 @@
|
|
|
|
|
*/ |
|
|
|
|
package org.springframework.data.mongodb.core.convert; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.Iterator; |
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.Map.Entry; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
import org.bson.BsonValue; |
|
|
|
|
import org.bson.Document; |
|
|
|
|
@ -431,6 +422,7 @@ public class QueryMapper {
@@ -431,6 +422,7 @@ public class QueryMapper {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Nullable |
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
protected Object convertSimpleOrDocument(Object source, @Nullable MongoPersistentEntity<?> entity) { |
|
|
|
|
|
|
|
|
|
if (source instanceof List) { |
|
|
|
|
@ -455,7 +447,7 @@ public class QueryMapper {
@@ -455,7 +447,7 @@ public class QueryMapper {
|
|
|
|
|
|
|
|
|
|
if (source instanceof Map) { |
|
|
|
|
|
|
|
|
|
LinkedHashMap<String, Object> map = new LinkedHashMap<>(); |
|
|
|
|
Map<String, Object> map = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
|
((Map<String, Object>) source).entrySet().forEach(it -> { |
|
|
|
|
|
|
|
|
|
@ -467,6 +459,7 @@ public class QueryMapper {
@@ -467,6 +459,7 @@ public class QueryMapper {
|
|
|
|
|
map.put(key, delegateConvertToMongoType(it.getValue(), entity)); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return map; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -656,12 +649,12 @@ public class QueryMapper {
@@ -656,12 +649,12 @@ public class QueryMapper {
|
|
|
|
|
static class Keyword { |
|
|
|
|
|
|
|
|
|
private static final String N_OR_PATTERN = "\\$.*or"; |
|
|
|
|
private static final Set<String> NON_DBREF_CONVERTING_KEYWORDS = new HashSet<>(Arrays.asList("$", "$size", "$slice", "$gt", "$lt")); |
|
|
|
|
private static final Set<String> NON_DBREF_CONVERTING_KEYWORDS = new HashSet<>( |
|
|
|
|
Arrays.asList("$", "$size", "$slice", "$gt", "$lt")); |
|
|
|
|
|
|
|
|
|
private final String key; |
|
|
|
|
private final Object value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Keyword(Bson source, String key) { |
|
|
|
|
this.key = key; |
|
|
|
|
this.value = BsonUtils.get(source, key); |
|
|
|
|
@ -723,7 +716,6 @@ public class QueryMapper {
@@ -723,7 +716,6 @@ public class QueryMapper {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @return {@literal true} if key may hold a DbRef. |
|
|
|
|
* @since 2.1.4 |
|
|
|
|
*/ |
|
|
|
|
@ -842,7 +834,6 @@ public class QueryMapper {
@@ -842,7 +834,6 @@ public class QueryMapper {
|
|
|
|
|
* |
|
|
|
|
* @return {@literal true} if property information is available and references a {@link java.util.Map}. |
|
|
|
|
* @see PersistentProperty#isMap() |
|
|
|
|
* @since 2.2 |
|
|
|
|
*/ |
|
|
|
|
public boolean isMap() { |
|
|
|
|
return getProperty() != null && getProperty().isMap(); |
|
|
|
|
|