Compare commits

..

16 Commits

Author SHA1 Message Date
Jens Schauder
8e51d005d5 DATAMONGO-2421 - Release version 2.1.14 (Lovelace SR14). 2019-12-04 11:42:03 +01:00
Jens Schauder
1940a5c2c2 DATAMONGO-2421 - Prepare 2.1.14 (Lovelace SR14). 2019-12-04 11:40:56 +01:00
Jens Schauder
5a274029d7 DATAMONGO-2421 - Updated changelog. 2019-12-04 11:40:47 +01:00
Mark Paluch
c342bf266e DATAMONGO-2410 - Polishing.
Simplify cast. Extend test with DBObject interface.

Original pull request: #813.
2019-12-04 08:58:36 +01:00
Christoph Strobl
11baf455d2 DATAMONGO-2410 - Fix Document to BasicDBObject conversion.
Original pull request: #813.
2019-12-04 08:58:09 +01:00
Mark Paluch
05882813ac DATAMONGO-2402 - Updated changelog. 2019-11-18 12:43:27 +01:00
Mark Paluch
bd3f26c928 DATAMONGO-2401 - After release cleanups. 2019-11-18 12:10:53 +01:00
Mark Paluch
5555aa970b DATAMONGO-2401 - Prepare next development iteration. 2019-11-18 12:10:52 +01:00
Mark Paluch
e74fe05abd DATAMONGO-2401 - Release version 2.1.13 (Lovelace SR13). 2019-11-18 12:01:05 +01:00
Mark Paluch
d579254fbc DATAMONGO-2401 - Prepare 2.1.13 (Lovelace SR13). 2019-11-18 12:00:43 +01:00
Mark Paluch
71c8e4cc02 DATAMONGO-2401 - Updated changelog. 2019-11-18 12:00:36 +01:00
Mark Paluch
a087c7d17c DATAMONGO-2409 - Polishing.
Adapt also ExecutableFindOperation.DistinctWithProjection.asType() to return the appropriate TerminatingDistinct.

Original pull request: #805.
2019-11-11 10:22:43 +01:00
Christoph Strobl
90cec275a6 DATAMONGO-2409 - Fix return type of Kotlin extension function for ReactiveFindOperation.DistinctWithProjection.asType().
Original pull request: #805.
2019-11-11 10:22:43 +01:00
Christoph Strobl
e4eefe577d DATAMONGO-2382 - Updated changelog. 2019-11-04 15:39:58 +01:00
Christoph Strobl
b57a6612f6 DATAMONGO-2381 - After release cleanups. 2019-11-04 10:26:37 +01:00
Christoph Strobl
62b2d54e0d DATAMONGO-2381 - Prepare next development iteration. 2019-11-04 10:26:35 +01:00
11 changed files with 69 additions and 15 deletions

View File

@@ -5,7 +5,7 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.1.12.RELEASE</version>
<version>2.1.14.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.12.RELEASE</version>
<version>2.1.14.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.12.RELEASE</springdata.commons>
<springdata.commons>2.1.14.RELEASE</springdata.commons>
<mongo>3.8.2</mongo>
<mongo.reactivestreams>1.9.2</mongo.reactivestreams>
<jmh.version>1.19</jmh.version>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.1.12.RELEASE</version>
<version>2.1.14.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.1.12.RELEASE</version>
<version>2.1.14.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.12.RELEASE</version>
<version>2.1.14.RELEASE</version>
</dependency>
<!-- reactive -->

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.1.12.RELEASE</version>
<version>2.1.14.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.1.12.RELEASE</version>
<version>2.1.14.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -211,11 +211,20 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
return conversionService.convert(bson, rawType);
}
if (DBObject.class.isAssignableFrom(rawType)) {
if (Document.class.isAssignableFrom(rawType)) {
return (S) bson;
}
if (Document.class.isAssignableFrom(rawType)) {
if (DBObject.class.isAssignableFrom(rawType)) {
if (bson instanceof DBObject) {
return (S) bson;
}
if (bson instanceof Document) {
return (S) new BasicDBObject((Document) bson);
}
return (S) bson;
}
@@ -1648,7 +1657,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
/**
* Returns whether the given type is a sub type of the given reference, i.e. assignable but not the exact same type.
*
*
* @param type must not be {@literal null}.
* @param reference must not be {@literal null}.
* @return

View File

@@ -70,7 +70,8 @@ fun <T : Any> ExecutableFindOperation.DistinctWithProjection.asType(resultType:
* Extension for [ExecutableFindOperation.DistinctWithProjection. as] leveraging reified type parameters.
*
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.1
*/
inline fun <reified T : Any> ExecutableFindOperation.DistinctWithProjection.asType(): ExecutableFindOperation.DistinctWithProjection =
inline fun <reified T : Any> ExecutableFindOperation.DistinctWithProjection.asType(): ExecutableFindOperation.TerminatingDistinct<T> =
`as`(T::class.java)

View File

@@ -68,5 +68,5 @@ fun <T : Any> ReactiveFindOperation.DistinctWithProjection.asType(resultType: KC
* @author Christoph Strobl
* @since 2.1
*/
inline fun <reified T : Any> ReactiveFindOperation.DistinctWithProjection.asType(): ReactiveFindOperation.DistinctWithProjection =
inline fun <reified T : Any> ReactiveFindOperation.DistinctWithProjection.asType(): ReactiveFindOperation.TerminatingDistinct<T> =
`as`(T::class.java)

View File

@@ -48,6 +48,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.ConversionNotSupportedException;
import org.springframework.beans.factory.annotation.Value;
@@ -84,6 +85,8 @@ import org.springframework.data.util.ClassTypeInformation;
import org.springframework.test.util.ReflectionTestUtils;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.DBRef;
/**
@@ -1926,6 +1929,15 @@ public class MappingMongoConverterUnitTests {
assertThat(order.items).hasSize(3);
}
@Test // DATAMONGO-2410
public void shouldAllowReadingBackDbObject() {
assertThat(converter.read(BasicDBObject.class, new org.bson.Document("property", "value")))
.isEqualTo(new BasicDBObject("property", "value"));
assertThat(converter.read(DBObject.class, new org.bson.Document("property", "value")))
.isEqualTo(new BasicDBObject("property", "value"));
}
static class GenericType<T> {
T content;
}
@@ -1947,7 +1959,7 @@ public class MappingMongoConverterUnitTests {
@Override
void method() {
}
}
};
abstract void method();

View File

@@ -1,6 +1,36 @@
Spring Data MongoDB Changelog
=============================
Changes in version 2.1.14.RELEASE (2019-12-04)
----------------------------------------------
* DATAMONGO-2421 - Release 2.1.14 (Lovelace SR14).
* DATAMONGO-2410 - Using BasicDBObject as an entity caused java.lang.ClassCastException in runtime.
Changes in version 2.2.2.RELEASE (2019-11-18)
---------------------------------------------
* DATAMONGO-2414 - ReactiveGridFsResource.getDownloadStream(…) hang if completion happens on event loop.
* DATAMONGO-2409 - Extension Function ReactiveFindOperation.DistinctWithProjection.asType() has wrong return type.
* DATAMONGO-2403 - ReactiveStringBasedAggregation / AggregationUtils fails on NPE because source or value is null.
* DATAMONGO-2402 - Release 2.2.2 (Moore SR2).
Changes in version 2.1.13.RELEASE (2019-11-18)
----------------------------------------------
* DATAMONGO-2409 - Extension Function ReactiveFindOperation.DistinctWithProjection.asType() has wrong return type.
* DATAMONGO-2401 - Release 2.1.13 (Lovelace SR13).
Changes in version 2.2.1.RELEASE (2019-11-04)
---------------------------------------------
* DATAMONGO-2399 - Upgrade to mongo-java-driver 3.11.1.
* DATAMONGO-2394 - nearSphere query wrongly generated with radian parameter instead of meters.
* DATAMONGO-2393 - Reading large file from ReactiveGridFsTemplate causes a stackoverflow and the code to hang.
* DATAMONGO-2392 - Reading GridFS files written with old api and custom id fails on ReactiveGridFsTemplate.
* DATAMONGO-2388 - IndexOperations.getIndexInfo() fails for index that has partialFilterExpression containing DBRef.
* DATAMONGO-2382 - Release 2.2.1 (Moore SR1).
Changes in version 2.1.12.RELEASE (2019-11-04)
----------------------------------------------
* DATAMONGO-2388 - IndexOperations.getIndexInfo() fails for index that has partialFilterExpression containing DBRef.
@@ -2790,3 +2820,4 @@ Repository
* Namespace support for Mongo repositories
* Allow usage of pagination and sorting with repositories

View File

@@ -1,4 +1,4 @@
Spring Data MongoDB 2.1.12
Spring Data MongoDB 2.1.14
Copyright (c) [2010-2019] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -8,3 +8,4 @@ This product may include a number of subcomponents with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and
conditions of the subcomponent's license, as noted in the LICENSE file.