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>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>2.1.0.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>Spring Data MongoDB</name>
|
<name>Spring Data MongoDB</name>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data.build</groupId>
|
<groupId>org.springframework.data.build</groupId>
|
||||||
<artifactId>spring-data-parent</artifactId>
|
<artifactId>spring-data-parent</artifactId>
|
||||||
<version>2.1.0.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.type>multi</project.type>
|
<project.type>multi</project.type>
|
||||||
<dist.id>spring-data-mongodb</dist.id>
|
<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>3.8.2</mongo>
|
||||||
<mongo.reactivestreams>1.9.2</mongo.reactivestreams>
|
<mongo.reactivestreams>1.9.2</mongo.reactivestreams>
|
||||||
<jmh.version>1.19</jmh.version>
|
<jmh.version>1.19</jmh.version>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>2.1.0.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>2.1.0.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb</artifactId>
|
<artifactId>spring-data-mongodb</artifactId>
|
||||||
<version>2.1.0.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- reactive -->
|
<!-- reactive -->
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>2.1.0.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>2.1.0.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation
|
|||||||
|
|
||||||
graphLookup.put("startWith", mappedStartWith.size() == 1 ? mappedStartWith.iterator().next() : mappedStartWith);
|
graphLookup.put("startWith", mappedStartWith.size() == 1 ? mappedStartWith.iterator().next() : mappedStartWith);
|
||||||
|
|
||||||
graphLookup.put("connectFromField", connectFrom.getName());
|
graphLookup.put("connectFromField", connectFrom.getTarget());
|
||||||
graphLookup.put("connectToField", connectTo.getName());
|
graphLookup.put("connectToField", connectTo.getTarget());
|
||||||
graphLookup.put("as", as.getName());
|
graphLookup.put("as", as.getName());
|
||||||
|
|
||||||
if (maxDepth != null) {
|
if (maxDepth != null) {
|
||||||
@@ -112,7 +112,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (depthField != null) {
|
if (depthField != null) {
|
||||||
graphLookup.put("depthField", depthField.getName());
|
graphLookup.put("depthField", depthField.getTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (restrictSearchWithMatch != null) {
|
if (restrictSearchWithMatch != null) {
|
||||||
|
|||||||
@@ -15,19 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.mongodb.core.aggregation;
|
package org.springframework.data.mongodb.core.aggregation;
|
||||||
|
|
||||||
import static org.hamcrest.core.Is.*;
|
import static org.springframework.data.mongodb.test.util.Assertions.*;
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import static org.springframework.data.mongodb.test.util.IsBsonObject.*;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.data.mongodb.core.Person;
|
import org.springframework.data.mongodb.core.Person;
|
||||||
import org.springframework.data.mongodb.core.query.Criteria;
|
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}.
|
* Unit tests for {@link GraphLookupOperation}.
|
||||||
*
|
*
|
||||||
@@ -54,8 +50,7 @@ public class GraphLookupOperationUnitTests {
|
|||||||
.as("reportingHierarchy");
|
.as("reportingHierarchy");
|
||||||
|
|
||||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||||
assertThat(document,
|
assertThat(document).containsEntry("$graphLookup.depthField", "depth").containsEntry("$graphLookup.maxDepth", 42L);
|
||||||
isBsonObject().containing("$graphLookup.depthField", "depth").containing("$graphLookup.maxDepth", 42L));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // DATAMONGO-1551
|
@Test // DATAMONGO-1551
|
||||||
@@ -70,8 +65,7 @@ public class GraphLookupOperationUnitTests {
|
|||||||
.as("reportingHierarchy");
|
.as("reportingHierarchy");
|
||||||
|
|
||||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||||
assertThat(document,
|
assertThat(document).containsEntry("$graphLookup.restrictSearchWithMatch", new Document("key", "value"));
|
||||||
isBsonObject().containing("$graphLookup.restrictSearchWithMatch", new Document("key", "value")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // DATAMONGO-1551
|
@Test // DATAMONGO-1551
|
||||||
@@ -86,9 +80,9 @@ public class GraphLookupOperationUnitTests {
|
|||||||
|
|
||||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||||
|
|
||||||
assertThat(document,
|
assertThat(document)
|
||||||
is(Document.parse("{ $graphLookup : { from: \"employees\", startWith: [\"$reportsTo\", \"$boss\"], "
|
.isEqualTo(Document.parse("{ $graphLookup : { from: \"employees\", startWith: [\"$reportsTo\", \"$boss\"], "
|
||||||
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }")));
|
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // DATAMONGO-1551
|
@Test // DATAMONGO-1551
|
||||||
@@ -103,9 +97,8 @@ public class GraphLookupOperationUnitTests {
|
|||||||
|
|
||||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||||
|
|
||||||
assertThat(document,
|
assertThat(document).containsEntry("$graphLookup.startWith",
|
||||||
is(Document.parse("{ $graphLookup : { from: \"employees\", startWith: [\"$reportsTo\", { $literal: \"$boss\"}], "
|
Arrays.asList("$reportsTo", new Document("$literal", "$boss")));
|
||||||
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class) // DATAMONGO-1551
|
@Test(expected = IllegalArgumentException.class) // DATAMONGO-1551
|
||||||
@@ -131,7 +124,39 @@ public class GraphLookupOperationUnitTests {
|
|||||||
|
|
||||||
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
Document document = graphLookupOperation.toDocument(Aggregation.DEFAULT_CONTEXT);
|
||||||
|
|
||||||
assertThat(document, is(Document.parse("{ $graphLookup : { from: \"employees\", startWith: { $literal: \"hello\"}, "
|
assertThat(document).containsEntry("$graphLookup.startWith", new Document("$literal", "hello"));
|
||||||
+ "connectFromField: \"reportsTo\", connectToField: \"name\", as: \"reportingHierarchy\" } }")));
|
}
|
||||||
|
|
||||||
|
@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
|
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)
|
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.
|
* 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.
|
Copyright (c) [2010-2015] Pivotal Software, Inc.
|
||||||
|
|
||||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||||
|
|||||||
Reference in New Issue
Block a user