Compare commits

..

9 Commits

Author SHA1 Message Date
Mark Paluch
c9d471e5d5 DATAMONGO-1799 - Release version 1.10.9 (Ingalls SR9). 2017-11-27 15:17:06 +01:00
Mark Paluch
6641277aaa DATAMONGO-1799 - Prepare 1.10.9 (Ingalls SR9). 2017-11-27 15:16:09 +01:00
Mark Paluch
29eba6e427 DATAMONGO-1799 - Updated changelog. 2017-11-27 15:16:04 +01:00
Oliver Gierke
d10e4afefd DATAMONGO-1737 - BasicMongoPersistentEntity now correctly initializes comparator.
In BasicMongoPersistentEntity.verify() we now properly call the super method to make sure the comparators that honor the @Field's order value are initialized properly.
2017-11-17 14:59:03 +01:00
Oliver Gierke
14bb4b586f DATAMONGO-1793 - Updated changelog. 2017-10-27 16:36:48 +02:00
Christoph Strobl
d795836994 DATAMONGO-1809 - Fix positional parameter detection for PropertyPaths.
We now make sure to capture all digits for positional parameters.

Original pull request: #508.
2017-10-24 14:53:33 +02:00
Mark Paluch
d216fed8db DATAMONGO-1696 - Mention appropriate EnableMongoAuditing annotation in reference documentation. 2017-10-20 08:45:47 +02:00
Oliver Gierke
26b7267737 DATAMONGO-1775 - After release cleanups. 2017-10-11 19:00:15 +02:00
Oliver Gierke
69d749d028 DATAMONGO-1775 - Prepare next development iteration. 2017-10-11 19:00:10 +02:00
13 changed files with 90 additions and 13 deletions

View File

@@ -5,7 +5,7 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>1.10.8.RELEASE</version>
<version>1.10.9.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>1.9.8.RELEASE</version>
<version>1.9.9.RELEASE</version>
</parent>
<modules>
@@ -28,7 +28,7 @@
<properties>
<project.type>multi</project.type>
<dist.id>spring-data-mongodb</dist.id>
<springdata.commons>1.13.8.RELEASE</springdata.commons>
<springdata.commons>1.13.9.RELEASE</springdata.commons>
<mongo>2.14.3</mongo>
<mongo.osgi>2.13.0</mongo.osgi>
<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>1.10.8.RELEASE</version>
<version>1.10.9.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>1.10.8.RELEASE</version>
<version>1.10.9.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -48,7 +48,7 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.10.8.RELEASE</version>
<version>1.10.9.RELEASE</version>
</dependency>
<dependency>

View File

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

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>1.10.8.RELEASE</version>
<version>1.10.9.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>1.10.8.RELEASE</version>
<version>1.10.9.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -863,7 +863,7 @@ public class QueryMapper {
try {
PropertyPath path = PropertyPath.from(pathExpression.replaceAll("\\.\\d", ""), entity.getTypeInformation());
PropertyPath path = PropertyPath.from(pathExpression.replaceAll("\\.\\d+", ""), entity.getTypeInformation());
PersistentPropertyPath<MongoPersistentProperty> propertyPath = mappingContext.getPersistentPropertyPath(path);
Iterator<MongoPersistentProperty> iterator = propertyPath.iterator();

View File

@@ -146,6 +146,8 @@ public class BasicMongoPersistentEntity<T> extends BasicPersistentEntity<T, Mong
@Override
public void verify() {
super.verify();
verifyFieldUniqueness();
verifyFieldTypes();
}

View File

@@ -21,6 +21,9 @@ import static org.mockito.Mockito.*;
import static org.springframework.data.mongodb.core.DBObjectTestUtils.*;
import static org.springframework.data.mongodb.test.util.IsBsonObject.*;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collections;
@@ -685,6 +688,23 @@ public class UpdateMapperUnitTests {
.containing("$set.concreteTypeWithListAttributeOfInterfaceType.models.[0]._class", ModelImpl.class.getName()));
}
@Test // DATAMONGO-1809
public void pathShouldIdentifyPositionalParameterWithMoreThanOneDigit() {
BasicDBObject at2digitPosition = (BasicDBObject) mapper.getMappedObject(new Update()
.addToSet("concreteInnerList.10.concreteTypeList", new SomeInterfaceImpl("szeth")).getUpdateObject(),
context.getPersistentEntity(Outer.class));
BasicDBObject at3digitPosition = (BasicDBObject) mapper.getMappedObject(new Update()
.addToSet("concreteInnerList.123.concreteTypeList", new SomeInterfaceImpl("lopen")).getUpdateObject(),
context.getPersistentEntity(Outer.class));
assertThat(at2digitPosition, is(equalTo(new BasicDBObject("$addToSet",
new BasicDBObject("concreteInnerList.10.concreteTypeList", new BasicDBObject("value", "szeth"))))));
assertThat(at3digitPosition, is(equalTo(new BasicDBObject("$addToSet",
new BasicDBObject("concreteInnerList.123.concreteTypeList", new BasicDBObject("value", "lopen"))))));
}
@Test // DATAMONGO-1236
public void mappingShouldRetainTypeInformationForObjectValues() {
@@ -1223,6 +1243,7 @@ public class UpdateMapperUnitTests {
static class ConcreteInner {
List<SomeInterfaceType> interfaceTypeList;
List<SomeAbstractType> abstractTypeList;
List<SomeInterfaceImpl> concreteTypeList;
}
interface SomeInterfaceType {
@@ -1233,8 +1254,11 @@ public class UpdateMapperUnitTests {
}
@AllArgsConstructor
@NoArgsConstructor
static class SomeInterfaceImpl extends SomeAbstractType implements SomeInterfaceType {
String value;
}
}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.data.mongodb.core.mapping;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -23,6 +23,8 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -30,6 +32,8 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AliasFor;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.SimplePropertyHandler;
import org.springframework.data.mapping.model.MappingException;
import org.springframework.data.util.ClassTypeInformation;
@@ -223,6 +227,25 @@ public class BasicMongoPersistentEntityUnitTests {
assertThat(entity.getCollection(), is("custom-collection"));
}
@Test // DATAMONGO-1737
public void honorsFieldOrderWhenIteratingOverProperties() {
MongoMappingContext context = new MongoMappingContext();
BasicMongoPersistentEntity<?> entity = context.getPersistentEntity(Sample.class);
final List<String> properties = new ArrayList<String>();
entity.doWithProperties(new SimplePropertyHandler() {
@Override
public void doWithPersistentProperty(PersistentProperty<?> property) {
properties.add(property.getName());
}
});
assertThat(properties, contains("first", "second", "third"));
}
@Document(collection = "contacts")
class Contact {}
@@ -253,6 +276,13 @@ public class BasicMongoPersistentEntityUnitTests {
@ComposedDocumentAnnotation
static class DocumentWithComposedAnnotation {}
class Sample {
@org.springframework.data.mongodb.core.mapping.Field(order = 2) String second;
@org.springframework.data.mongodb.core.mapping.Field(order = 3) String third;
@org.springframework.data.mongodb.core.mapping.Field(order = 1) String first;
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Document(collection = "collection-1")

View File

@@ -29,5 +29,5 @@ class Config {
----
====
If you expose a bean of type `AuditorAware` to the `ApplicationContext`, the auditing infrastructure will pick it up automatically and use it to determine the current user to be set on domain types. If you have multiple implementations registered in the `ApplicationContext`, you can select the one to be used by explicitly setting the `auditorAwareRef` attribute of `@EnableJpaAuditing`.
If you expose a bean of type `AuditorAware` to the `ApplicationContext`, the auditing infrastructure will pick it up automatically and use it to determine the current user to be set on domain types. If you have multiple implementations registered in the `ApplicationContext`, you can select the one to be used by explicitly setting the `auditorAwareRef` attribute of `@EnableMongoAuditing`.

View File

@@ -1,6 +1,27 @@
Spring Data MongoDB Changelog
=============================
Changes in version 1.10.9.RELEASE (2017-11-27)
----------------------------------------------
* DATAMONGO-1809 - Type hint usage broken when using positional parameters with more than one digit.
* DATAMONGO-1799 - Release 1.10.9 (Ingalls SR9).
* DATAMONGO-1696 - Reference documentation uses JPA Annotations.
Changes in version 2.0.1.RELEASE (2017-10-27)
---------------------------------------------
* DATAMONGO-1815 - Adapt API changes in Property in test cases.
* DATAMONGO-1814 - Missing documentation on Faceted classification.
* DATAMONGO-1811 - Reference Documentation doesn't match with API Documentation 2.X vesrion.
* DATAMONGO-1809 - Type hint usage broken when using positional parameters with more than one digit.
* DATAMONGO-1806 - GridFsResource wrong type in javaDoc.
* DATAMONGO-1805 - Documentation for operations.find uses wrong result type.
* DATAMONGO-1802 - No converter found capable of converting from type org.bson.types.Binary to type byte[].
* DATAMONGO-1795 - Remove obsolete Kotlin build configuration.
* DATAMONGO-1793 - Release 2.0.1 (Kay SR1).
* DATAMONGO-1696 - Reference documentation uses JPA Annotations.
Changes in version 1.10.8.RELEASE (2017-10-11)
----------------------------------------------
* DATAMONGO-1784 - Add support for AggregationExpression in GroupOperation.sum.

View File

@@ -1,4 +1,4 @@
Spring Data MongoDB 1.10.8
Spring Data MongoDB 1.10.9
Copyright (c) [2010-2015] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").