@@ -178,7 +178,8 @@ class DocumentPointerFactory {
|
||||
}
|
||||
|
||||
this.documentPointer = org.bson.Document.parse(targetLookup);
|
||||
this.isSimpleTargetPointer = placeholderMap.size() == 1 && placeholderMap.containsValue("target") && lookup.contains("#target");
|
||||
this.isSimpleTargetPointer = placeholderMap.size() == 1 && placeholderMap.containsValue("target")
|
||||
&& lookup.contains("#target");
|
||||
}
|
||||
|
||||
private String placeholder(int index) {
|
||||
@@ -248,7 +249,7 @@ class DocumentPointerFactory {
|
||||
target.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if(target.size()==1 && isSimpleTargetPointer) {
|
||||
if (target.size() == 1 && isSimpleTargetPointer) {
|
||||
return target.values().iterator().next();
|
||||
}
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ public class QueryMapper {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(property.isDocumentReference()) {
|
||||
if (property.isDocumentReference()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1415,8 +1415,8 @@ public class QueryMapper {
|
||||
String partial = iterator.next();
|
||||
currentIndex++;
|
||||
|
||||
boolean isPositional = isPositionalParameter(partial) && property.isCollectionLike() ;
|
||||
if(property.isMap() && currentPropertyRoot.equals(partial) && iterator.hasNext()){
|
||||
boolean isPositional = isPositionalParameter(partial) && property.isCollectionLike();
|
||||
if (property.isMap() && currentPropertyRoot.equals(partial) && iterator.hasNext()) {
|
||||
partial = iterator.next();
|
||||
currentIndex++;
|
||||
}
|
||||
@@ -1428,7 +1428,7 @@ public class QueryMapper {
|
||||
inspect = isPositional && iterator.hasNext();
|
||||
}
|
||||
|
||||
if(currentIndex + 1 < pathParts.size()) {
|
||||
if (currentIndex + 1 < pathParts.size()) {
|
||||
currentIndex++;
|
||||
currentPropertyRoot = pathParts.get(currentIndex);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ import org.springframework.data.mongodb.core.query.BasicQuery;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.TextQuery;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.MongoClientSettings;
|
||||
@@ -1557,10 +1556,10 @@ public class QueryMapperUnitTests {
|
||||
|
||||
private String name;
|
||||
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
|
||||
private Customer customer;
|
||||
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
|
||||
private List<Customer> customers;
|
||||
|
||||
@DocumentReference
|
||||
|
||||
@@ -35,9 +35,9 @@ import org.bson.types.ObjectId;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
@@ -47,9 +47,7 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
import org.springframework.data.mapping.MappingException;
|
||||
import org.springframework.data.mongodb.MongoDatabaseFactory;
|
||||
import org.springframework.data.mongodb.core.DocumentTestUtils;
|
||||
import org.springframework.data.mongodb.core.MongoExceptionTranslator;
|
||||
import org.springframework.data.mongodb.core.mapping.DocumentReference;
|
||||
import org.springframework.data.mongodb.core.mapping.Field;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
||||
@@ -1699,10 +1697,10 @@ class UpdateMapperUnitTests {
|
||||
|
||||
private String name;
|
||||
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
|
||||
private Customer customer;
|
||||
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
|
||||
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
|
||||
private List<Customer> customers;
|
||||
|
||||
@DocumentReference
|
||||
|
||||
Reference in New Issue
Block a user