|
|
|
@ -21,7 +21,6 @@ import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import org.bson.Document; |
|
|
|
import org.bson.Document; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.data.mongodb.core.convert.MappingMongoConverter; |
|
|
|
import org.springframework.data.mongodb.core.convert.MappingMongoConverter; |
|
|
|
import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver; |
|
|
|
import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver; |
|
|
|
import org.springframework.data.mongodb.core.convert.QueryMapper; |
|
|
|
import org.springframework.data.mongodb.core.convert.QueryMapper; |
|
|
|
@ -106,6 +105,22 @@ class SetOperationUnitTests { |
|
|
|
.containsExactly(Document.parse("{\"$set\" : {\"totalHomework\": { \"$sum\" : \"$homework\" }}}")); |
|
|
|
.containsExactly(Document.parse("{\"$set\" : {\"totalHomework\": { \"$sum\" : \"$homework\" }}}")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // GH-4933
|
|
|
|
|
|
|
|
void rendersTargetFieldReferenceCorrectly() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat( |
|
|
|
|
|
|
|
SetOperation.builder().set("totalHomework").toValueOf("homework").toPipelineStages(contextFor(Scores.class))) |
|
|
|
|
|
|
|
.containsExactly(Document.parse("{\"$set\" : {\"totalHomework\": \"$homework\" }}")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // GH-4933
|
|
|
|
|
|
|
|
void rendersMappedTargetFieldReferenceCorrectly() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(SetOperation.builder().set("totalHomework").toValueOf("homework") |
|
|
|
|
|
|
|
.toPipelineStages(contextFor(ScoresWithMappedField.class))) |
|
|
|
|
|
|
|
.containsExactly(Document.parse("{\"$set\" : {\"totalHomework\": \"$home_work\" }}")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test // DATAMONGO-2331
|
|
|
|
@Test // DATAMONGO-2331
|
|
|
|
void exposesFieldsCorrectly() { |
|
|
|
void exposesFieldsCorrectly() { |
|
|
|
|
|
|
|
|
|
|
|
|