Compare commits

...

17 Commits

Author SHA1 Message Date
Christoph Strobl
7047bb23cf Release version 3.4.10 (2021.2.10).
See #4313
2023-03-20 13:43:04 +01:00
Christoph Strobl
3876fbfaf3 Prepare 3.4.10 (2021.2.10).
See #4313
2023-03-20 13:42:32 +01:00
Mark Paluch
76f25ef2d2 Polishing.
Remove duplicate logging in imperative FindOneCallback.

See #4253
Original pull request: #4259
2023-03-17 09:36:32 +01:00
Raghav2211
d3e9c28375 Remove duplicate log in reactive findOne operation.
Closes #4253
Original pull request: #4259
2023-03-17 09:36:32 +01:00
Christoph Strobl
6b7ac32ea0 Fix property value conversion for $in clauses.
This commit fixes an issue where a property value converter is not applied if the query is using an $in clause that compares the value against a collection of potential candidates.

Original pull request: #4324
Closes #4080
2023-03-15 17:07:49 +01:00
Mark Paluch
6004c9a9eb After release cleanups.
See #4292
2023-03-03 10:22:37 +01:00
Mark Paluch
4d08042966 Prepare next development iteration.
See #4292
2023-03-03 10:22:35 +01:00
Mark Paluch
5d53099336 Release version 3.4.9 (2021.2.9).
See #4292
2023-03-03 10:19:07 +01:00
Mark Paluch
4744065a2e Prepare 3.4.9 (2021.2.9).
See #4292
2023-03-03 10:18:47 +01:00
Mark Paluch
20ef448094 Upgrade to Maven Wrapper 3.9.0.
See #4299
2023-02-20 12:01:58 +01:00
Mark Paluch
4fcb9f20b9 After release cleanups.
See #4271
2023-02-17 10:11:45 +01:00
Mark Paluch
a3081d243b Prepare next development iteration.
See #4271
2023-02-17 10:11:43 +01:00
Mark Paluch
c8a4dea162 Release version 3.4.8 (2021.2.8).
See #4271
2023-02-17 10:08:25 +01:00
Mark Paluch
42a4169a25 Prepare 3.4.8 (2021.2.8).
See #4271
2023-02-17 10:08:08 +01:00
Mark Paluch
d4b804eaca Update CI properties.
See #4271
2023-01-30 10:48:57 +01:00
Mark Paluch
fe0688c044 After release cleanups.
See #4233
2023-01-13 10:35:34 +01:00
Mark Paluch
0eea02a859 Prepare next development iteration.
See #4233
2023-01-13 10:35:33 +01:00
11 changed files with 46 additions and 57 deletions

View File

@@ -1,2 +1,2 @@
#Fri Jun 03 09:39:35 CEST 2022
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
#Mon Feb 20 12:01:58 CET 2023
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip

View File

@@ -1,7 +1,7 @@
# Java versions
java.main.tag=8u352-b08-jdk-focal
java.next.tag=11.0.17_8-jdk-focal
java.lts.tag=17.0.5_8-jdk-focal
java.main.tag=8u362-b09-jdk-focal
java.next.tag=11.0.18_10-jdk-focal
java.lts.tag=17.0.6_10-jdk-focal
# Docker container images - standard
docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag}
@@ -10,11 +10,11 @@ docker.java.lts.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclip
# Supported versions of MongoDB
docker.mongodb.4.0.version=4.0.28
docker.mongodb.4.4.version=4.4.17
docker.mongodb.5.0.version=5.0.13
docker.mongodb.4.4.version=4.4.18
docker.mongodb.5.0.version=5.0.14
# Supported versions of Redis
docker.redis.6.version=6.2.6
docker.redis.6.version=6.2.10
# Supported versions of Cassandra
docker.cassandra.3.version=3.11.14

View File

@@ -5,7 +5,7 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>3.4.7</version>
<version>3.4.10</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.7.7</version>
<version>2.7.10</version>
</parent>
<modules>
@@ -26,7 +26,7 @@
<properties>
<project.type>multi</project.type>
<dist.id>spring-data-mongodb</dist.id>
<springdata.commons>2.7.7</springdata.commons>
<springdata.commons>2.7.10</springdata.commons>
<mongo>4.6.1</mongo>
<mongo.reactivestreams>${mongo}</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>3.4.7</version>
<version>3.4.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>3.4.7</version>
<version>3.4.10</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>3.4.7</version>
<version>3.4.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -68,16 +67,7 @@ import org.springframework.data.mongodb.core.aggregation.AggregationOperationCon
import org.springframework.data.mongodb.core.aggregation.AggregationOptions;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.TypedAggregation;
import org.springframework.data.mongodb.core.convert.DbRefResolver;
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
import org.springframework.data.mongodb.core.convert.JsonSchemaMapper;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
import org.springframework.data.mongodb.core.convert.MongoJsonSchemaMapper;
import org.springframework.data.mongodb.core.convert.MongoWriter;
import org.springframework.data.mongodb.core.convert.QueryMapper;
import org.springframework.data.mongodb.core.convert.UpdateMapper;
import org.springframework.data.mongodb.core.convert.*;
import org.springframework.data.mongodb.core.index.IndexOperations;
import org.springframework.data.mongodb.core.index.IndexOperationsProvider;
import org.springframework.data.mongodb.core.index.MongoMappingEventPublisher;
@@ -118,16 +108,7 @@ import com.mongodb.ClientSessionOptions;
import com.mongodb.MongoException;
import com.mongodb.ReadPreference;
import com.mongodb.WriteConcern;
import com.mongodb.client.AggregateIterable;
import com.mongodb.client.ClientSession;
import com.mongodb.client.DistinctIterable;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MapReduceIterable;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.MongoIterable;
import com.mongodb.client.*;
import com.mongodb.client.model.*;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
@@ -3077,13 +3058,6 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
FindIterable<Document> iterable = cursorPreparer.initiateFind(collection, col -> col.find(query, Document.class));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("findOne using query: %s fields: %s in db.collection: %s",
serializeToJsonSafely(query), serializeToJsonSafely(fields.orElseGet(Document::new)),
collection.getNamespace() != null ? collection.getNamespace().getFullName() : "n/a"));
}
if (fields.isPresent()) {
iterable = iterable.projection(fields.get());
}

View File

@@ -3019,13 +3019,6 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
public Publisher<Document> doInCollection(MongoCollection<Document> collection)
throws MongoException, DataAccessException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
String.format("findOne using query: %s fields: %s in db.collection: %s", serializeToJsonSafely(query),
serializeToJsonSafely(fields.orElseGet(Document::new)), collection.getNamespace().getFullName()));
}
FindPublisher<Document> publisher = preparer.initiateFind(collection, col -> col.find(query, Document.class));
if (fields.isPresent()) {

View File

@@ -27,10 +27,11 @@ import org.bson.BsonValue;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.bson.types.ObjectId;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.annotation.Reference;
import org.springframework.data.convert.PropertyValueConverter;
import org.springframework.data.convert.ValueConversionContext;
import org.springframework.data.domain.Example;
import org.springframework.data.mapping.Association;
import org.springframework.data.mapping.MappingException;
@@ -438,9 +439,18 @@ public class QueryMapper {
if (documentField.getProperty() != null
&& converter.getCustomConversions().getPropertyValueConversions().hasValueConverter(documentField.getProperty())) {
return converter.getCustomConversions().getPropertyValueConversions()
.getValueConverter(documentField.getProperty())
.write(value, new MongoConversionContext(documentField.getProperty(), converter));
MongoConversionContext conversionContext = new MongoConversionContext(documentField.getProperty(), converter);
PropertyValueConverter<Object, Object, ValueConversionContext<MongoPersistentProperty>> valueConverter = converter
.getCustomConversions().getPropertyValueConversions().getValueConverter(documentField.getProperty());
/* might be an $in clause with multiple entries */
if (!documentField.getProperty().isCollectionLike() && sourceValue instanceof Collection<?>) {
Collection<?> collection = (Collection<?>) sourceValue;
return collection.stream().map(it -> valueConverter.write(it, conversionContext)).collect(Collectors.toList());
}
return valueConverter.write(value, conversionContext);
}
if (documentField.isIdField() && !documentField.isAssociation()) {

View File

@@ -1453,7 +1453,7 @@ public class QueryMapperUnitTests {
assertThat(mappedQuery.get("_id"))
.isEqualTo(org.bson.Document.parse("{ $in: [ {$oid: \"5b8bedceb1e0bfc07b008828\" } ]}"));
}
@Test // GH-3596
void considersValueConverterWhenPresent() {
@@ -1461,6 +1461,15 @@ public class QueryMapperUnitTests {
assertThat(mappedObject).isEqualTo(new org.bson.Document("text", "eulav"));
}
@Test // GH-4080
void convertsListOfValuesForPropertyThatHasValueConverterButIsNotCollectionLikeOneByOne() {
org.bson.Document mappedObject = mapper.getMappedObject(query(where("text").in("spring", "data")).getQueryObject(),
context.getPersistentEntity(WithPropertyValueConverter.class));
assertThat(mappedObject).isEqualTo("{ 'text' : { $in : ['gnirps', 'atad'] } }");
}
class WithDeepArrayNesting {
List<WithNestedArray> level0;
@@ -1739,9 +1748,9 @@ public class QueryMapperUnitTests {
static class MyAddress {
private String street;
}
static class WithPropertyValueConverter {
@ValueConverter(ReversingValueConverter.class)
String text;
}

View File

@@ -1,4 +1,4 @@
Spring Data MongoDB 3.4.7 (2021.2.7)
Spring Data MongoDB 3.4.10 (2021.2.10)
Copyright (c) [2010-2019] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -41,6 +41,9 @@ conditions of the subcomponent's license, as noted in the LICENSE file.