Compare commits
15 Commits
2.1.15.REL
...
2.1.16.REL
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
383b7031dd | ||
|
|
e8f0ed8d59 | ||
|
|
f90d30472b | ||
|
|
cec1c8305a | ||
|
|
cd714b1ba8 | ||
|
|
0a83eec8b2 | ||
|
|
3a28fb18f6 | ||
|
|
6e65d2fd1d | ||
|
|
8d63c10e07 | ||
|
|
aee5f71229 | ||
|
|
5cc044b72c | ||
|
|
45243468ec | ||
|
|
5a162bdbaf | ||
|
|
1d15eaf42e | ||
|
|
0076e294ae |
6
pom.xml
6
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>2.1.15.RELEASE</version>
|
||||
<version>2.1.16.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.15.RELEASE</version>
|
||||
<version>2.1.16.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.15.RELEASE</springdata.commons>
|
||||
<springdata.commons>2.1.16.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.15.RELEASE</version>
|
||||
<version>2.1.16.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.15.RELEASE</version>
|
||||
<version>2.1.16.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.15.RELEASE</version>
|
||||
<version>2.1.16.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- reactive -->
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>2.1.15.RELEASE</version>
|
||||
<version>2.1.16.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.15.RELEASE</version>
|
||||
<version>2.1.16.RELEASE</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ import com.mongodb.DBRef;
|
||||
* @author Jordi Llach
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class MappingMongoConverter extends AbstractMongoConverter implements ApplicationContextAware, ValueResolver {
|
||||
public class MappingMongoConverter extends AbstractMongoConverter implements ApplicationContextAware {
|
||||
|
||||
private static final String INCOMPATIBLE_TYPES = "Cannot convert %1$s of type %2$s into an instance of %3$s! Implement a custom Converter<%2$s, %3$s> and register it with the CustomConversions. Parent object was: %4$s";
|
||||
private static final String INVALID_TYPE_TO_READ = "Expected to read Document %s into type %s but didn't find a PersistentEntity for the latter!";
|
||||
@@ -115,7 +115,8 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
|
||||
this.idMapper = new QueryMapper(this);
|
||||
|
||||
this.spELContext = new SpELContext(DocumentPropertyAccessor.INSTANCE);
|
||||
this.dbRefProxyHandler = new DefaultDbRefProxyHandler(spELContext, mappingContext, MappingMongoConverter.this);
|
||||
this.dbRefProxyHandler = new DefaultDbRefProxyHandler(spELContext, mappingContext,
|
||||
MappingMongoConverter.this::getValueInternal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,7 +395,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
|
||||
SpELExpressionEvaluator evaluator) {
|
||||
|
||||
return new DefaultDbRefResolverCallback(documentAccessor.getDocument(), currentPath, evaluator,
|
||||
MappingMongoConverter.this);
|
||||
MappingMongoConverter.this::getValueInternal);
|
||||
}
|
||||
|
||||
private void readAssociation(Association<MongoPersistentProperty> association, PersistentPropertyAccessor<?> accessor,
|
||||
@@ -996,7 +997,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mongodb.core.convert.ValueResolver#getValueInternal(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty, com.mongodb.Document, org.springframework.data.mapping.model.SpELExpressionEvaluator, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getValueInternal(MongoPersistentProperty prop, Bson bson, SpELExpressionEvaluator evaluator,
|
||||
ObjectPath path) {
|
||||
return new MongoDbPropertyValueProvider(bson, evaluator, path).getPropertyValue(prop);
|
||||
@@ -1440,7 +1441,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
|
||||
}
|
||||
|
||||
DbRefResolverCallback callback = new DefaultDbRefResolverCallback(accessor.getDocument(), path, evaluator,
|
||||
MappingMongoConverter.this);
|
||||
MappingMongoConverter.this::getValueInternal);
|
||||
|
||||
DBRef dbref = rawRefValue instanceof DBRef ? (DBRef) rawRefValue : null;
|
||||
return (T) dbRefResolver.resolveDbRef(property, dbref, callback, dbRefProxyHandler);
|
||||
|
||||
@@ -19,12 +19,14 @@ import org.bson.Document;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Internal API to trigger the resolution of properties.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
interface ValueResolver {
|
||||
|
||||
@@ -38,6 +40,6 @@ interface ValueResolver {
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
Object getValueInternal(MongoPersistentProperty prop, Bson bson, SpELExpressionEvaluator evaluator,
|
||||
ObjectPath path);
|
||||
@Nullable
|
||||
Object getValueInternal(MongoPersistentProperty prop, Bson bson, SpELExpressionEvaluator evaluator, ObjectPath path);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,10 @@ public class Person {
|
||||
----
|
||||
====
|
||||
|
||||
Note that the domain type shown in the preceding example has a property named `id` of type `ObjectId`. The default serialization mechanism used in `MongoTemplate` (which backs the repository support) regards properties named `id` as the document ID. Currently, we support `String`, `ObjectId`, and `BigInteger` as ID types. Now that we have a domain object, we can define an interface that uses it, as follows:
|
||||
Note that the domain type shown in the preceding example has a property named `id` of type `String`. The default serialization mechanism used in `MongoTemplate` (which backs the repository support) regards properties named `id` as the document ID. Currently, we support `String`, `ObjectId`, and `BigInteger` as ID types.
|
||||
Please see <<mongo-template.id-handling, ID mapping>> for more information about on how the `id` field is handled in the mapping layer.
|
||||
|
||||
Now that we have a domain object, we can define an interface that uses it, as follows:
|
||||
|
||||
.Basic repository interface to persist Person entities
|
||||
====
|
||||
@@ -93,7 +96,7 @@ class ApplicationConfig extends AbstractMongoConfiguration {
|
||||
|
||||
@Override
|
||||
protected String getMappingBasePackage() {
|
||||
return "com.oreilly.springdata.mongodb"
|
||||
return "com.oreilly.springdata.mongodb";
|
||||
}
|
||||
}
|
||||
----
|
||||
@@ -309,7 +312,7 @@ The following example shows how to define a `near` query that finds all persons
|
||||
====
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends MongoRepository<Person, String>
|
||||
public interface PersonRepository extends MongoRepository<Person, String> {
|
||||
|
||||
// { 'location' : { '$near' : [point.x, point.y], '$maxDistance' : distance}}
|
||||
List<Person> findByLocationNear(Point location, Distance distance);
|
||||
@@ -342,7 +345,7 @@ Spring Data MongoDb supports geo-near queries, as the following example shows:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends MongoRepository<Person, String>
|
||||
public interface PersonRepository extends MongoRepository<Person, String> {
|
||||
|
||||
// {'geoNear' : 'location', 'near' : [x, y] }
|
||||
GeoResults<Person> findByLocationNear(Point location);
|
||||
@@ -369,7 +372,7 @@ By adding the `org.springframework.data.mongodb.repository.Query` annotation to
|
||||
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends MongoRepository<Person, String>
|
||||
public interface PersonRepository extends MongoRepository<Person, String> {
|
||||
|
||||
@Query("{ 'firstname' : ?0 }")
|
||||
List<Person> findByThePersonsFirstname(String firstname);
|
||||
@@ -385,7 +388,7 @@ You can also use the filter property to restrict the set of properties that is m
|
||||
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends MongoRepository<Person, String>
|
||||
public interface PersonRepository extends MongoRepository<Person, String> {
|
||||
|
||||
@Query(value="{ 'firstname' : ?0 }", fields="{ 'firstname' : 1, 'lastname' : 1}")
|
||||
List<Person> findByThePersonsFirstname(String firstname);
|
||||
@@ -436,7 +439,7 @@ to declare the predicate value for `lastname` (which is equivalent to the `?0` p
|
||||
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends MongoRepository<Person, String>
|
||||
public interface PersonRepository extends MongoRepository<Person, String> {
|
||||
|
||||
@Query("{'lastname': ?#{[0]} }")
|
||||
List<Person> findByQueryWithExpression(String param0);
|
||||
@@ -448,7 +451,7 @@ used in conjunction with JSON reveal a side-effect, because Map-like declaration
|
||||
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends MongoRepository<Person, String>
|
||||
public interface PersonRepository extends MongoRepository<Person, String> {
|
||||
|
||||
@Query("{'id': ?#{ [0] ? {$exists :true} : [1] }}")
|
||||
List<Person> findByQueryWithExpressionAndNestedObject(boolean param0, String param1);
|
||||
|
||||
@@ -41,7 +41,10 @@ public class Person {
|
||||
----
|
||||
====
|
||||
|
||||
Note that the entity defined in the preceding example has a property named `id` of type `ObjectId`. The default serialization mechanism used in `MongoTemplate` (which backs the repository support) regards properties named `id` as the document ID. Currently, we support `String`, `ObjectId`, and `BigInteger` as id-types. The following example shows how to create an interface that defines queries against the `Person` object from the preceding example:
|
||||
Note that the entity defined in the preceding example has a property named `id` of type `String`. The default serialization mechanism used in `MongoTemplate` (which backs the repository support) regards properties named `id` as the document ID. Currently, we support `String`, `ObjectId`, and `BigInteger` as id-types.
|
||||
Please see <<mongo-template.id-handling, ID mapping>> for more information about on how the `id` field is handled in the mapping layer.
|
||||
|
||||
The following example shows how to create an interface that defines queries against the `Person` object from the preceding example:
|
||||
|
||||
.Basic repository interface to persist Person entities
|
||||
====
|
||||
@@ -93,7 +96,7 @@ class ApplicationConfig extends AbstractReactiveMongoConfiguration {
|
||||
|
||||
@Override
|
||||
protected String getMappingBasePackage() {
|
||||
return "com.oreilly.springdata.mongodb"
|
||||
return "com.oreilly.springdata.mongodb";
|
||||
}
|
||||
}
|
||||
----
|
||||
@@ -117,6 +120,20 @@ public class PersonRepositoryTests {
|
||||
----
|
||||
====
|
||||
|
||||
WARNING: The `Page` return type (as in `Mono<Page>`) is not supported by reactive repositories.
|
||||
|
||||
It is possible to use `Pageable` in derived finder methods, to pass on `sort`, `limit` and `offset` parameters to the query to reduce load and network traffic.
|
||||
The returned `Flux` will only emit data within the declared range.
|
||||
|
||||
.Limit and Offset with reactive repositories
|
||||
====
|
||||
[source,java]
|
||||
----
|
||||
Pageable page = PageRequest.of(1, 10, Sort.by("lastname"));
|
||||
Flux<Person> persons = repository.findByFirstnameOrderByLastname("luke", page);
|
||||
----
|
||||
====
|
||||
|
||||
[[mongo.reactive.repositories.features]]
|
||||
== Features
|
||||
|
||||
@@ -144,7 +161,7 @@ The following example shows how to define a `near` query that finds all persons
|
||||
====
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends ReactiveMongoRepository<Person, String>
|
||||
public interface PersonRepository extends ReactiveMongoRepository<Person, String> {
|
||||
|
||||
// { 'location' : { '$near' : [point.x, point.y], '$maxDistance' : distance}}
|
||||
Flux<Person> findByLocationNear(Point location, Distance distance);
|
||||
@@ -179,7 +196,7 @@ Spring Data MongoDB supports geo-near queries, as the following example shows:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
public interface PersonRepository extends ReactiveMongoRepository<Person, String>
|
||||
public interface PersonRepository extends ReactiveMongoRepository<Person, String> {
|
||||
|
||||
// {'geoNear' : 'location', 'near' : [x, y] }
|
||||
Flux<GeoResult<Person>> findByLocationNear(Point location);
|
||||
|
||||
@@ -1,6 +1,83 @@
|
||||
Spring Data MongoDB Changelog
|
||||
=============================
|
||||
|
||||
Changes in version 2.1.16.RELEASE (2020-02-26)
|
||||
----------------------------------------------
|
||||
* DATAMONGO-2464 - Fix code examples in reference documentation.
|
||||
* DATAMONGO-2459 - Update Documentation of Reactive Repositories to mention usage of PageRequest.
|
||||
* DATAMONGO-2457 - Reference documentation: Text does not match with code example.
|
||||
* DATAMONGO-2452 - Release 2.1.16 (Lovelace SR16).
|
||||
* DATAMONGO-2079 - MappingMongoConverter cannot be proxied because it implements the package-private ValueResolver interface.
|
||||
|
||||
|
||||
Changes in version 3.0.0.M3 (2020-02-12)
|
||||
----------------------------------------
|
||||
* DATAMONGO-2470 - Adapt tests to AssertJ 3.15.0.
|
||||
* DATAMONGO-2464 - Fix code examples in reference documentation.
|
||||
* DATAMONGO-2462 - Move off deprecated EntityInstantiators.
|
||||
* DATAMONGO-2461 - Fix Jenkins build.
|
||||
* DATAMONGO-2460 - @Field annotation behaviour changed.
|
||||
* DATAMONGO-2459 - Update Documentation of Reactive Repositories to mention usage of PageRequest.
|
||||
* DATAMONGO-2457 - Reference documentation: Text does not match with code example.
|
||||
* DATAMONGO-2456 - Release 3.0 M3 (Neumann).
|
||||
* DATAMONGO-2449 - Add aggregation options parameters to @Aggregation annotation.
|
||||
* DATAMONGO-2427 - Switch to 4.0-beta1 MongoDB driver.
|
||||
* DATAMONGO-2417 - Typesafe Extension Function for ReactiveFindOperation.FindDistinct.
|
||||
* DATAMONGO-2406 - Allow Mono<Void> as return type for derived deleteBy queries.
|
||||
* DATAMONGO-2400 - Read/write converters not working.
|
||||
* DATAMONGO-2365 - Parameter hint in Query#hint is not index name.
|
||||
* DATAMONGO-2249 - Query hint leads to error when executed via reactive template.
|
||||
* DATAMONGO-2079 - MappingMongoConverter cannot be proxied because it implements the package-private ValueResolver interface.
|
||||
* DATAMONGO-1997 - Add support to return the single deleted item for a deleteBy query method.
|
||||
|
||||
|
||||
Changes in version 3.0.0.M2 (2020-01-17)
|
||||
----------------------------------------
|
||||
* DATAMONGO-2454 - Release 3.0 M2 (Neumann).
|
||||
|
||||
|
||||
Changes in version 3.0.0.M1 (2020-01-16)
|
||||
----------------------------------------
|
||||
* DATAMONGO-2451 - Value of sort direction converted to String for id fields (query, index creation).
|
||||
* DATAMONGO-2450 - Bulk Operations do not support filterArray in update operations.
|
||||
* DATAMONGO-2448 - Bump Version to 3.0.
|
||||
* DATAMONGO-2447 - Upgrade MongoDB Drivers to 3.12.0 and 1.13.0.
|
||||
* DATAMONGO-2444 - Update copyright years to 2020.
|
||||
* DATAMONGO-2442 - Cond.thenValueOf(String fieldReference) does not concat fieldRef with "$" prefix.
|
||||
* DATAMONGO-2440 - Unable to use MongoTemplate to perform query with 'in' condition by field annotated with @Field(targetType = FieldType.OBJECT_ID).
|
||||
* DATAMONGO-2437 - Grouping after aggregation returns NULL _id when mapping to a class with compound key.
|
||||
* DATAMONGO-2430 - Upgrade to mongo-java-driver 3.11.2.
|
||||
* DATAMONGO-2423 - @NonNullApi restricts update with null.
|
||||
* DATAMONGO-2418 - Application Context Doesn't start with @Query.
|
||||
* DATAMONGO-2414 - ReactiveGridFsResource.getDownloadStream(…) hang if completion happens on event loop.
|
||||
* DATAMONGO-2410 - Using BasicDBObject as an entity caused java.lang.ClassCastException in runtime.
|
||||
* 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-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-2390 - Add maxTimeMS to AggregationOptions.
|
||||
* DATAMONGO-2388 - IndexOperations.getIndexInfo() fails for index that has partialFilterExpression containing DBRef.
|
||||
* DATAMONGO-2385 - Unnecessary null checks in MongoConverters.
|
||||
* DATAMONGO-2383 - Release 3.0 M1 (Neumann).
|
||||
* DATAMONGO-2370 - Add support for $round aggregation expression.
|
||||
* DATAMONGO-2331 - Add support for Aggregations in Update.
|
||||
* DATAMONGO-2059 - Replace usage of deprecated collection.count() with collection.countDocuments().
|
||||
* DATAMONGO-765 - Add support for paging and sorting on GridFSTemplate.
|
||||
|
||||
|
||||
Changes in version 2.2.4.RELEASE (2020-01-15)
|
||||
---------------------------------------------
|
||||
* DATAMONGO-2451 - Value of sort direction converted to String for id fields (query, index creation).
|
||||
* DATAMONGO-2450 - Bulk Operations do not support filterArray in update operations.
|
||||
* DATAMONGO-2444 - Update copyright years to 2020.
|
||||
* DATAMONGO-2442 - Cond.thenValueOf(String fieldReference) does not concat fieldRef with "$" prefix.
|
||||
* DATAMONGO-2440 - Unable to use MongoTemplate to perform query with 'in' condition by field annotated with @Field(targetType = FieldType.OBJECT_ID).
|
||||
* DATAMONGO-2432 - Release 2.2.4 (Moore SR4).
|
||||
* DATAMONGO-2423 - @NonNullApi restricts update with null.
|
||||
|
||||
|
||||
Changes in version 2.1.15.RELEASE (2020-01-15)
|
||||
----------------------------------------------
|
||||
* DATAMONGO-2444 - Update copyright years to 2020.
|
||||
@@ -2839,3 +2916,8 @@ Repository
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Spring Data MongoDB 2.1.15
|
||||
Spring Data MongoDB 2.1.16
|
||||
Copyright (c) [2010-2019] Pivotal Software, Inc.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
@@ -10,3 +10,4 @@ code for the these subcomponents is subject to the terms and
|
||||
conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user