Compare commits
7 Commits
main
...
2.1.1.RELE
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f19f769c4 | ||
|
|
a40e89d90a | ||
|
|
6b2350200a | ||
|
|
fb50b0f6e7 | ||
|
|
ab568229b5 | ||
|
|
7f9c1bd774 | ||
|
|
670a0978da |
6
pom.xml
6
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Spring Data MongoDB</name>
|
||||
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
@@ -27,7 +27,7 @@
|
||||
<properties>
|
||||
<project.type>multi</project.type>
|
||||
<dist.id>spring-data-mongodb</dist.id>
|
||||
<springdata.commons>2.1.0.RELEASE</springdata.commons>
|
||||
<springdata.commons>2.1.1.RELEASE</springdata.commons>
|
||||
<mongo>3.8.2</mongo>
|
||||
<mongo.reactivestreams>1.9.2</mongo.reactivestreams>
|
||||
<jmh.version>1.19</jmh.version>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- reactive -->
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -103,8 +103,8 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation
|
||||
|
||||
graphLookup.put("startWith", mappedStartWith.size() == 1 ? mappedStartWith.iterator().next() : mappedStartWith);
|
||||
|
||||
graphLookup.put("connectFromField", connectFrom.getName());
|
||||
graphLookup.put("connectToField", connectTo.getName());
|
||||
graphLookup.put("connectFromField", connectFrom.getTarget());
|
||||
graphLookup.put("connectToField", connectTo.getTarget());
|
||||
graphLookup.put("as", as.getName());
|
||||
|
||||
if (maxDepth != null) {
|
||||
@@ -112,7 +112,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation
|
||||
}
|
||||
|
||||
if (depthField != null) {
|
||||
graphLookup.put("depthField", depthField.getName());
|
||||
graphLookup.put("depthField", depthField.getTarget());
|
||||
}
|
||||
|
||||
if (restrictSearchWithMatch != null) {
|
||||
|
||||
@@ -15,19 +15,15 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core.aggregation;
|
||||
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.data.mongodb.test.util.IsBsonObject.*;
|
||||
import static org.springframework.data.mongodb.test.util.Assertions.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.mongodb.core.Person;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.util.JSON;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GraphLookupOperation}.
|
||||
*
|
||||
@@ -54,8 +50,7 @@ public class GraphLookupOperationUnitTests {
|
||||
.as("reportingHierarchy");
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
assertThat(document,
|
||||
isBsonObject().containing("$graphLookup.depthField", "depth").containing("$graphLookup.maxDepth", 42L));
|
||||
assertThat(document).containsEntry("$graphLookup.depthField", "depth").containsEntry("$graphLookup.maxDepth", 42L);
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1551
|
||||
@@ -70,8 +65,7 @@ public class GraphLookupOperationUnitTests {
|
||||
.as("reportingHierarchy");
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
assertThat(document,
|
||||
isBsonObject().containing("$graphLookup.restrictSearchWithMatch", new Document("key", "value")));
|
||||
assertThat(document).containsEntry("$graphLookup.restrictSearchWithMatch", new Document("key", "value"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1551
|
||||
@@ -86,9 +80,9 @@ public class GraphLookupOperationUnitTests {
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
|
||||
assertThat(document,
|
||||
is(Document.parse("{ $graphLookup : { from: \"employees\", startWith: [\"$reportsTo\", \"$boss\"], "
|
||||
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }")));
|
||||
assertThat(document)
|
||||
.isEqualTo(Document.parse("{ $graphLookup : { from: \"employees\", startWith: [\"$reportsTo\", \"$boss\"], "
|
||||
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1551
|
||||
@@ -103,9 +97,8 @@ public class GraphLookupOperationUnitTests {
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
|
||||
assertThat(document,
|
||||
is(Document.parse("{ $graphLookup : { from: \"employees\", startWith: [\"$reportsTo\", { $literal: \"$boss\"}], "
|
||||
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }")));
|
||||
assertThat(document).containsEntry("$graphLookup.startWith",
|
||||
Arrays.asList("$reportsTo", new Document("$literal", "$boss")));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAMONGO-1551
|
||||
@@ -131,7 +124,39 @@ public class GraphLookupOperationUnitTests {
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
|
||||
assertThat(document, is(Document.parse("{ $graphLookup : { from: \"employees\", startWith: { $literal: \"hello\"}, "
|
||||
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }")));
|
||||
assertThat(document).containsEntry("$graphLookup.startWith", new Document("$literal", "hello"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-2096
|
||||
public void connectFromShouldUseTargetFieldInsteadOfAlias() {
|
||||
|
||||
AggregationOperation graphLookupOperation = Aggregation.graphLookup("user").startWith("contacts.userId")
|
||||
.connectFrom("contacts.userId").connectTo("_id").depthField("numConnections").as("connections");
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
|
||||
assertThat(document).containsEntry("$graphLookup.startWith", "$contacts.userId");
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-2096
|
||||
public void connectToShouldUseTargetFieldInsteadOfAlias() {
|
||||
|
||||
AggregationOperation graphLookupOperation = Aggregation.graphLookup("user").startWith("contacts.userId")
|
||||
.connectFrom("userId").connectTo("connectto.field").depthField("numConnections").as("connections");
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
|
||||
assertThat(document).containsEntry("$graphLookup.connectToField", "connectto.field");
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-2096
|
||||
public void depthFieldShouldUseTargetFieldInsteadOfAlias() {
|
||||
|
||||
AggregationOperation graphLookupOperation = Aggregation.graphLookup("user").startWith("contacts.userId")
|
||||
.connectFrom("contacts.userId").connectTo("_id").depthField("foo.bar").as("connections");
|
||||
|
||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||
|
||||
assertThat(document).containsEntry("$graphLookup.depthField", "foo.bar");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
Spring Data MongoDB Changelog
|
||||
=============================
|
||||
|
||||
Changes in version 2.1.1.RELEASE (2018-10-15)
|
||||
---------------------------------------------
|
||||
* DATAMONGO-2096 - Aggregation.graphLookup.**.connectFrom(String) does not handle nested field.
|
||||
* DATAMONGO-2094 - Release 2.1.1 (Lovelace SR1).
|
||||
|
||||
|
||||
Changes in version 2.1.0.RELEASE (2018-09-21)
|
||||
---------------------------------------------
|
||||
* DATAMONGO-2091 - Upgrade to MongoDB Java Driver 3.8.2 and Reactive Streams Driver 1.9.2.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Spring Data MongoDB 2.1 GA
|
||||
Spring Data MongoDB 2.1.1
|
||||
Copyright (c) [2010-2015] Pivotal Software, Inc.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
|
||||
Reference in New Issue
Block a user