Compare commits

...

20 Commits

Author SHA1 Message Date
Oliver Gierke
91cdf83a4f DATAMONGO-1670 - Release version 1.9.10 (Hopper SR10). 2017-04-19 20:36:43 +02:00
Oliver Gierke
0b6f7ce3ce DATAMONGO-1670 - Prepare 1.9.10 (Hopper SR10). 2017-04-19 20:36:07 +02:00
Oliver Gierke
a48c6c5733 DATAMONGO-1670 - Updated changelog. 2017-04-19 20:36:01 +02:00
Oliver Gierke
035a72ec1f DATAMONGO-1669 - Updated changelog. 2017-04-19 20:01:49 +02:00
Oliver Gierke
06dcfc3098 DATAMONGO-1634 - After release cleanups. 2017-04-19 13:01:05 +02:00
Oliver Gierke
d512f78479 DATAMONGO-1634 - Prepare next development iteration. 2017-04-19 13:01:02 +02:00
Oliver Gierke
7c9f744d9b DATAMONGO-1634 - Release version 1.9.9 (Hopper SR9). 2017-04-19 12:38:29 +02:00
Oliver Gierke
fb5998fb62 DATAMONGO-1634 - Prepare 1.9.9 (Hopper SR9). 2017-04-19 12:37:52 +02:00
Oliver Gierke
edfd25fbcc DATAMONGO-1634 - Updated changelog. 2017-04-19 12:37:43 +02:00
Oliver Gierke
325de75b11 DATAMONGO-1633 - Updated changelog. 2017-04-19 11:50:50 +02:00
Oliver Gierke
859d9d5d83 DATAMONGO-1535 - Updated changelog. 2017-04-11 09:07:44 +02:00
Michael J. Simons
8f5091b2d5 DATAMONGO-1662 - Fix classname in reference docs about projections in aggregations.
Original pull request: #455.
2017-04-10 09:12:46 +02:00
Mark Paluch
5e0ced9f3a DATAMONGO-1645 - Polishing.
Clean up appender and log level after test run. Suppress log output during tests.

Original pull request: #450.
2017-03-21 10:56:59 +01:00
Christoph Strobl
8cf9ee0f1f DATAMONGO-1645 - Safely serialize JSON output for log message in LoggingEventListener.
We now make sure to safely serialize JSON output for mapped documents. This prevents the logger from rendering false exception messages to log appender.

Original pull request: #450.
2017-03-21 10:56:55 +01:00
Mark Paluch
5e77a08b30 DATAMONGO-1421 - Polishing.
Remove trailing whitespaces. Construct exception message with String.format(…).

Original pull request: #448.
2017-03-08 08:50:49 +01:00
Christoph Strobl
6b1d95b20d DATAMONGO-1421 - Fix serialization in error message causing error itself.
We now make sure to safely serialize the criteria object used for creating the error message when raising an `InvalidMongoDbApiUsageException` in cases where `addCriteria` is used to add multiple entries for the same property.

Original pull request: #448.
2017-03-08 08:50:47 +01:00
Oliver Gierke
0171084b1a DATAMONGO-1639 - Polishing.
Formatting in MongoTemplateUnitTests.
2017-03-06 16:25:01 +01:00
Oliver Gierke
b46baa8a25 DATAMONGO-1639 - Make sure BeforeConvertEvent sees new version for updates.
The changes for DATAMONGO-1617 subtley changed the behavior for entity updates in terms of the version value they see for entities using optimistic locking. Previously the updates already saw the new version value, where after the fix for DATAMONGO-1617 it saw the old one. That caused BeforeConvertEvent listeners not being able to distinguish between an original insert and the first update anymore.

This change is now rolled back and we introduced a test case that encodes this expectation explicitly.
2017-03-06 16:25:01 +01:00
Oliver Gierke
96d45ca70d DATAMONGO-1597 - After release cleanups. 2017-03-02 12:05:57 +01:00
Oliver Gierke
aeb3a89825 DATAMONGO-1597 - Prepare next development iteration. 2017-03-02 12:05:54 +01:00
14 changed files with 309 additions and 51 deletions

View File

@@ -5,7 +5,7 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>1.9.8.RELEASE</version>
<version>1.9.10.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.8.8.RELEASE</version>
<version>1.8.10.RELEASE</version>
</parent>
<modules>
@@ -28,7 +28,7 @@
<properties>
<project.type>multi</project.type>
<dist.id>spring-data-mongodb</dist.id>
<springdata.commons>1.12.8.RELEASE</springdata.commons>
<springdata.commons>1.12.10.RELEASE</springdata.commons>
<mongo>2.14.3</mongo>
<mongo.osgi>2.13.0</mongo.osgi>
</properties>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>1.9.8.RELEASE</version>
<version>1.9.10.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -48,7 +48,7 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.9.8.RELEASE</version>
<version>1.9.10.RELEASE</version>
</dependency>
<dependency>

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>1.9.8.RELEASE</version>
<version>1.9.10.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.9.8.RELEASE</version>
<version>1.9.10.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.9.8.RELEASE</version>
<version>1.9.10.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -985,16 +985,12 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware {
doInsert(collectionName, objectToSave, this.mongoConverter);
} else {
maybeEmitEvent(new BeforeConvertEvent<T>(objectToSave, collectionName));
assertUpdateableIdIfNotSet(objectToSave);
// Create query for entity with the id and old version
Object id = convertingAccessor.getProperty(idProperty);
Query query = new Query(Criteria.where(idProperty.getName()).is(id).and(versionProperty.getName()).is(version));
// Bump version number
convertingAccessor.setProperty(versionProperty, versionNumber.longValue() + 1);
maybeEmitEvent(new BeforeConvertEvent<T>(objectToSave, collectionName));
assertUpdateableIdIfNotSet(objectToSave);
BasicDBObject dbObject = new BasicDBObject();
this.mongoConverter.write(objectToSave, dbObject);
@@ -1002,6 +998,10 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware {
maybeEmitEvent(new BeforeSaveEvent<T>(objectToSave, dbObject, collectionName));
Update update = Update.fromDBObject(dbObject, ID_FIELD);
// Create query for entity with the id and old version
Object id = convertingAccessor.getProperty(idProperty);
Query query = new Query(Criteria.where(idProperty.getName()).is(id).and(versionProperty.getName()).is(version));
doUpdate(collectionName, query, update, objectToSave.getClass(), false, false);
maybeEmitEvent(new AfterSaveEvent<T>(objectToSave, dbObject, collectionName));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
*/
package org.springframework.data.mongodb.core.mapping.event;
import static org.springframework.data.mongodb.core.query.SerializationUtils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
@@ -23,9 +25,10 @@ import com.mongodb.DBObject;
/**
* {@link ApplicationListener} for Mongo mapping events logging the events.
*
*
* @author Jon Brisbin
* @author Martin Baumgartner
* @author Christoph Strobl
*/
public class LoggingEventListener extends AbstractMongoEventListener<Object> {
@@ -46,7 +49,7 @@ public class LoggingEventListener extends AbstractMongoEventListener<Object> {
*/
@Override
public void onBeforeSave(Object source, DBObject dbo) {
LOGGER.info("onBeforeSave: {}, {}", source, dbo);
LOGGER.info("onBeforeSave: {}, {}", source, serializeToJsonSafely(dbo));
}
/*
@@ -55,7 +58,7 @@ public class LoggingEventListener extends AbstractMongoEventListener<Object> {
*/
@Override
public void onAfterSave(Object source, DBObject dbo) {
LOGGER.info("onAfterSave: {}, {}", source, dbo);
LOGGER.info("onAfterSave: {}, {}", source, serializeToJsonSafely(dbo));
}
/*
@@ -64,7 +67,7 @@ public class LoggingEventListener extends AbstractMongoEventListener<Object> {
*/
@Override
public void onAfterLoad(DBObject dbo) {
LOGGER.info("onAfterLoad: {}", dbo);
LOGGER.info("onAfterLoad: {}", serializeToJsonSafely(dbo));
}
/*
@@ -73,7 +76,7 @@ public class LoggingEventListener extends AbstractMongoEventListener<Object> {
*/
@Override
public void onAfterConvert(DBObject dbo, Object source) {
LOGGER.info("onAfterConvert: {}, {}", dbo, source);
LOGGER.info("onAfterConvert: {}, {}", serializeToJsonSafely(dbo), source);
}
/*
@@ -82,7 +85,7 @@ public class LoggingEventListener extends AbstractMongoEventListener<Object> {
*/
@Override
public void onAfterDelete(DBObject dbo) {
LOGGER.info("onAfterDelete: {}", dbo);
LOGGER.info("onAfterDelete: {}", serializeToJsonSafely(dbo));
}
/*
@@ -91,6 +94,6 @@ public class LoggingEventListener extends AbstractMongoEventListener<Object> {
*/
@Override
public void onBeforeDelete(DBObject dbo) {
LOGGER.info("onBeforeDelete: {}", dbo);
LOGGER.info("onBeforeDelete: {}", serializeToJsonSafely(dbo));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 the original author or authors.
* Copyright 2010-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ public class Query {
/**
* Static factory method to create a {@link Query} using the provided {@link CriteriaDefinition}.
*
*
* @param criteriaDefinition must not be {@literal null}.
* @return
* @since 1.6
@@ -71,7 +71,7 @@ public class Query {
/**
* Creates a new {@link Query} using the given {@link CriteriaDefinition}.
*
*
* @param criteriaDefinition must not be {@literal null}.
* @since 1.6
*/
@@ -81,7 +81,7 @@ public class Query {
/**
* Adds the given {@link CriteriaDefinition} to the current {@link Query}.
*
*
* @param criteriaDefinition must not be {@literal null}.
* @return
* @since 1.6
@@ -95,8 +95,8 @@ public class Query {
this.criteria.put(key, criteriaDefinition);
} else {
throw new InvalidMongoDbApiUsageException(
"Due to limitations of the com.mongodb.BasicDBObject, " + "you can't add a second '" + key + "' criteria. "
+ "Query already contains '" + existing.getCriteriaObject() + "'.");
String.format("Due to limitations of the com.mongodb.BasicDBObject, you can't add a second '%s' criteria. "
+ "Query already contains '%s'", key, serializeToJsonSafely(existing.getCriteriaObject())));
}
return this;
@@ -111,7 +111,7 @@ public class Query {
/**
* Set number of documents to skip before returning results.
*
*
* @param skip
* @return
*/
@@ -122,7 +122,7 @@ public class Query {
/**
* Limit the number of returned documents to {@code limit}.
*
*
* @param limit
* @return
*/
@@ -133,7 +133,7 @@ public class Query {
/**
* Configures the query to use the given hint when being executed.
*
*
* @param name must not be {@literal null} or empty.
* @return
*/
@@ -146,7 +146,7 @@ public class Query {
/**
* Sets the given pagination information on the {@link Query} instance. Will transparently set {@code skip} and
* {@code limit} as well as applying the {@link Sort} instance defined with the {@link Pageable}.
*
*
* @param pageable
* @return
*/
@@ -164,7 +164,7 @@ public class Query {
/**
* Adds a {@link Sort} to the {@link Query} instance.
*
*
* @param sort
* @return
*/
@@ -199,7 +199,7 @@ public class Query {
/**
* Restricts the query to only return documents instances that are exactly of the given types.
*
*
* @param type may not be {@literal null}
* @param additionalTypes may not be {@literal null}
* @return
@@ -253,7 +253,7 @@ public class Query {
/**
* Get the number of documents to skip.
*
*
* @return
*/
public int getSkip() {
@@ -262,7 +262,7 @@ public class Query {
/**
* Get the maximum number of documents to be return.
*
*
* @return
*/
public int getLimit() {
@@ -388,7 +388,7 @@ public class Query {
/**
* Tests whether the settings of the given {@link Query} are equal to this query.
*
*
* @param that
* @return
*/
@@ -405,7 +405,7 @@ public class Query {
return criteriaEqual && fieldsEqual && sortEqual && hintEqual && skipEqual && limitEqual && metaEqual;
}
/*
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@@ -427,7 +427,7 @@ public class Query {
/**
* Returns whether the given key is the one used to hold the type restriction information.
*
*
* @deprecated don't call this method as the restricted type handling will undergo some significant changes going
* forward.
* @param key

View File

@@ -52,6 +52,8 @@ import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
import org.springframework.data.mongodb.core.convert.QueryMapper;
import org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent;
import org.springframework.data.mongodb.core.mapreduce.MapReduceOptions;
import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Criteria;
@@ -72,6 +74,7 @@ import com.mongodb.MapReduceOutput;
import com.mongodb.Mongo;
import com.mongodb.MongoException;
import com.mongodb.ReadPreference;
import com.mongodb.WriteResult;
/**
* Unit tests for {@link MongoTemplate}.
@@ -367,8 +370,8 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
@Test
public void aggregateShouldHonorReadPreferenceWhenSet() {
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn(
mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class)))
.thenReturn(mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class))).thenReturn(mock(CommandResult.class));
template.setReadPreference(ReadPreference.secondary());
@@ -383,8 +386,8 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
@Test
public void aggregateShouldIgnoreReadPreferenceWhenNotSet() {
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn(
mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class)))
.thenReturn(mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class))).thenReturn(mock(CommandResult.class));
template.aggregate(Aggregation.newAggregation(Aggregation.unwind("foo")), "collection-1", Wrapper.class);
@@ -398,8 +401,8 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
@Test
public void geoNearShouldHonorReadPreferenceWhenSet() {
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn(
mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class)))
.thenReturn(mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class))).thenReturn(mock(CommandResult.class));
template.setReadPreference(ReadPreference.secondary());
@@ -415,8 +418,8 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
@Test
public void geoNearShouldIgnoreReadPreferenceWhenNotSet() {
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class))).thenReturn(
mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class), Mockito.any(ReadPreference.class)))
.thenReturn(mock(CommandResult.class));
when(db.command(Mockito.any(DBObject.class))).thenReturn(mock(CommandResult.class));
NearQuery query = NearQuery.near(new Point(1, 1));
@@ -531,6 +534,33 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
assertThat(captor.getValue().getLimit(), is(1000));
}
@Test // DATAMONGO-1639
public void beforeConvertEventForUpdateSeesNextVersion() {
final VersionedEntity entity = new VersionedEntity();
entity.id = 1;
entity.version = 0;
GenericApplicationContext context = new GenericApplicationContext();
context.refresh();
context.addApplicationListener(new AbstractMongoEventListener<VersionedEntity>() {
@Override
public void onBeforeConvert(BeforeConvertEvent<VersionedEntity> event) {
assertThat(event.getSource().version, is(1));
}
});
template.setApplicationContext(context);
MongoTemplate spy = Mockito.spy(template);
doReturn(mock(WriteResult.class)).when(spy).doUpdate(anyString(), Mockito.any(Query.class),
Mockito.any(Update.class), Mockito.any(Class.class), anyBoolean(), anyBoolean());
spy.save(entity);
}
class AutogenerateableId {
@Id BigInteger id;

View File

@@ -0,0 +1,124 @@
/*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.mongodb.core.mapping.event;
import static org.hamcrest.core.StringStartsWith.*;
import static org.junit.Assert.*;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;
import com.mongodb.BasicDBObject;
/**
* Tests for {@link LoggingEventListener}.
*
* @author Christoph Strobl
* @author Mark Paluch
*/
public class LoggingEventListenerTests {
ListAppender<ILoggingEvent> appender;
ch.qos.logback.classic.Logger logger;
LoggingEventListener listener;
@Before
public void setUp() {
appender = new ListAppender<ILoggingEvent>();
// set log level for LoggingEventListener to "info" and set up an appender capturing events.
logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(LoggingEventListener.class);
logger.setAdditive(false);
logger.setLevel(Level.INFO);
logger.addAppender(appender);
appender.start();
listener = new LoggingEventListener();
}
@After
public void tearDown() {
// cleanup
if (logger != null) {
logger.detachAppender(appender);
logger.setAdditive(true);
logger.setLevel(null);
}
if (appender != null) {
appender.stop();
}
}
@Test // DATAMONGO-1645
public void shouldSerializeAfterConvertEventCorrectly() {
listener.onAfterConvert(new AfterConvertEvent<Object>(new BasicDBObject("foo", new Foo()), this, "collection"));
assertThat(appender.list.get(0).getFormattedMessage(), startsWith("onAfterConvert: { \"foo\""));
}
@Test // DATAMONGO-1645
public void shouldSerializeBeforeSaveEventEventCorrectly() {
listener.onBeforeSave(new BeforeSaveEvent<Object>(new Foo(), new BasicDBObject("foo", new Foo()), "collection"));
assertThat(appender.list.get(0).getFormattedMessage(),
startsWith("onBeforeSave: org.springframework.data.mongodb.core."));
}
@Test // DATAMONGO-1645
public void shouldSerializeAfterSaveEventEventCorrectly() {
listener.onAfterSave(new AfterSaveEvent<Object>(new Foo(), new BasicDBObject("foo", new Foo()), "collection"));
assertThat(appender.list.get(0).getFormattedMessage(),
startsWith("onAfterSave: org.springframework.data.mongodb.core."));
}
@Test // DATAMONGO-1645
public void shouldSerializeBeforeDeleteEventEventCorrectly() {
listener
.onBeforeDelete(new BeforeDeleteEvent<Object>(new BasicDBObject("foo", new Foo()), Object.class, "collection"));
assertThat(appender.list.get(0).getFormattedMessage(), startsWith("onBeforeDelete: { \"foo\""));
}
@Test // DATAMONGO-1645
public void shouldSerializeAfterDeleteEventEventCorrectly() {
listener
.onAfterDelete(new AfterDeleteEvent<Object>(new BasicDBObject("foo", new Foo()), Object.class, "collection"));
assertThat(appender.list.get(0).getFormattedMessage(), startsWith("onAfterDelete: { \"foo\""));
}
static class Foo {
}
}

View File

@@ -33,11 +33,12 @@ import org.springframework.data.mongodb.core.SpecialDoc;
/**
* Unit tests for {@link Query}.
*
*
* @author Thomas Risberg
* @author Oliver Gierke
* @author Patryk Wasik
* @author Thomas Darimont
* @author Christoph Strobl
*/
public class QueryTests {
@@ -213,4 +214,20 @@ public class QueryTests {
assertThat(query.getRestrictedTypes().size(), is(1));
assertThat(query.getRestrictedTypes(), hasItems(Arrays.asList(SpecialDoc.class).toArray(new Class<?>[0])));
}
@Test // DATAMONGO-1421
public void addCriteriaForSamePropertyMultipleTimesShouldThrowAndSafelySerializeErrorMessage() {
exception.expect(InvalidMongoDbApiUsageException.class);
exception.expectMessage("second 'value' criteria");
exception.expectMessage("already contains '{ \"value\" : { $java : VAL_1 } }'");
Query query = new Query();
query.addCriteria(where("value").is(EnumType.VAL_1));
query.addCriteria(where("value").is(EnumType.VAL_2));
}
enum EnumType {
VAL_1, VAL_2
}
}

View File

@@ -1678,7 +1678,7 @@ Note that the aggregation operations not listed here are currently not supported
[[mongo.aggregation.projection]]
=== Projection Expressions
Projection expressions are used to define the fields that are the outcome of a particular aggregation step. Projection expressions can be defined via the `project` method of the `Aggregate` class either by passing a list of ``String``'s or an aggregation framework `Fields` object. The projection can be extended with additional fields through a fluent API via the `and(String)` method and aliased via the `as(String)` method.
Projection expressions are used to define the fields that are the outcome of a particular aggregation step. Projection expressions can be defined via the `project` method of the `Aggregation` class either by passing a list of ``String``'s or an aggregation framework `Fields` object. The projection can be extended with additional fields through a fluent API via the `and(String)` method and aliased via the `as(String)` method.
Note that one can also define fields with aliases via the static factory method `Fields.field` of the aggregation framework that can then be used to construct a new `Fields` instance. References to projected fields in later aggregation stages are only valid by using the field name of included fields or their alias of aliased or newly defined fields. Fields not included in the projection cannot be referenced in later aggregation stages.
.Projection expression examples

View File

@@ -1,6 +1,90 @@
Spring Data MongoDB Changelog
=============================
Changes in version 1.9.10.RELEASE (2017-04-19)
----------------------------------------------
* DATAMONGO-1670 - Release 1.9.10 (Hopper SR10).
Changes in version 1.10.3.RELEASE (2017-04-19)
----------------------------------------------
* DATAMONGO-1669 - Release 1.10.3 (Ingalls SR3).
Changes in version 1.9.9.RELEASE (2017-04-19)
---------------------------------------------
* DATAMONGO-1662 - Section "Projection Expressions" contains error "Aggregate".
* DATAMONGO-1645 - RuntimeException when logging BeforeDeleteEvent and AfterDeleteEvent.
* DATAMONGO-1639 - BeforeConvertEvent now sees old version values for update of entities.
* DATAMONGO-1634 - Release 1.9.9 (Hopper SR9).
* DATAMONGO-1421 - Repository with Enum argument: json can't serialize type.
Changes in version 1.10.2.RELEASE (2017-04-19)
----------------------------------------------
* DATAMONGO-1666 - Constructor creation with bulk fetching of DBRefs uses List instead of collection type.
* DATAMONGO-1662 - Section "Projection Expressions" contains error "Aggregate".
* DATAMONGO-1645 - RuntimeException when logging BeforeDeleteEvent and AfterDeleteEvent.
* DATAMONGO-1639 - BeforeConvertEvent now sees old version values for update of entities.
* DATAMONGO-1633 - Release 1.10.2 (Ingalls SR2).
* DATAMONGO-1620 - Not able to set serverSelectionTimeout on MongoClientOptions using MongoClientOptionsFactoryBean.
* DATAMONGO-1421 - Repository with Enum argument: json can't serialize type.
Changes in version 2.0.0.M2 (2017-04-04)
----------------------------------------
* DATAMONGO-1656 - Upgrade to MongoDB Driver 3.4.2 and Reactive Streams Driver 1.3.0.
* DATAMONGO-1655 - Remove obsolete build profiles.
* DATAMONGO-1648 - Rename getRepositoryFactoryClassName to getRepositoryFactoryBeanClassName.
* DATAMONGO-1647 - Use IdentifierAccessor.getRequiredIdentifier() in MongoTemplate.doSaveVersioned(…).
* DATAMONGO-1645 - RuntimeException when logging BeforeDeleteEvent and AfterDeleteEvent.
* DATAMONGO-1643 - Add namespace xsd for 2.x.
* DATAMONGO-1641 - Remove formatting config from the repository.
* DATAMONGO-1639 - BeforeConvertEvent now sees old version values for update of entities.
* DATAMONGO-1637 - Add support for aggregation result streaming.
* DATAMONGO-1620 - Not able to set serverSelectionTimeout on MongoClientOptions using MongoClientOptionsFactoryBean.
* DATAMONGO-1617 - IDs with non-autogeneratable type cannot be assigned automatically with custom event listeners.
* DATAMONGO-1610 - Support RxJava 2 repositories.
* DATAMONGO-1608 - NullPointerException with null argument when using IgnoreCase.
* DATAMONGO-1607 - Class Cast Exception when retrieve data Point with value equal integer.
* DATAMONGO-1605 - All SPEL values are converted to String.
* DATAMONGO-1603 - @Query Annotation Placeholder Issue.
* DATAMONGO-1602 - Remove references to single-argument assertion methods of Spring.
* DATAMONGO-1600 - GraphLookupOperationBuilder is not visible.
* DATAMONGO-1596 - Reference to wrong annotation in cross-store reference documentation.
* DATAMONGO-1594 - Update "whats new" section in reference documentation.
* DATAMONGO-1590 - Entity new detection doesn't consider Persistable.isNew().
* DATAMONGO-1589 - Update project documentation with the CLA tool integration.
* DATAMONGO-1588 - Repository will not accept Point subclass in spatial query.
* DATAMONGO-1587 - Migrate ticket references in test code to Spring Framework style.
* DATAMONGO-1586 - TypeBasedAggregationOperationContext.getReferenceFor(…) exposes fields with their leaf property name.
* DATAMONGO-1585 - Aggregation sort references target field of projected and aliased fields.
* DATAMONGO-1581 - ReactiveMongoRepositoryConfigurationExtension should be public.
* DATAMONGO-1578 - Add missing @Test annotation to ProjectionOperationUnitTests.
* DATAMONGO-1577 - Fix Reference and JavaDoc spelling issues.
* DATAMONGO-1576 - AbstractMongoEventListener methods not called when working with member fields.
* DATAMONGO-1575 - Treat String replacement values in StringBased queries as such unless they are SpEL expressions.
* DATAMONGO-1567 - Upgrade to a newer JDK version on TravisCI.
* DATAMONGO-1566 - Adapt API in RepositoryFactoryBeanSupport implementation.
* DATAMONGO-1565 - Placeholders in manually defined queries not escaped properly.
* DATAMONGO-1564 - Split up AggregationExpressions.
* DATAMONGO-1559 - Migrate reactive tests from TestSubscriber to StepVerifier.
* DATAMONGO-1558 - Upgrade travis-ci profile to MongoDB 3.4.
* DATAMONGO-1552 - Add $facet, $bucket and $bucketAuto aggregation stages.
* DATAMONGO-1551 - Add $graphLookup aggregation stage.
* DATAMONGO-1550 - Add $replaceRoot aggregation stage.
* DATAMONGO-1549 - Add $count aggregation stage.
* DATAMONGO-1548 - Add new MongoDB 3.4 aggregation operators.
* DATAMONGO-1547 - Register repository factory in spring.factories for multi-store support.
* DATAMONGO-1546 - Switch to new way of registering custom Jackson modules.
* DATAMONGO-1542 - Refactor CondOperator and IfNullOperator to children of AggregationExpressions.
* DATAMONGO-1540 - Add support for $map to aggregation.
* DATAMONGO-1539 - Add dedicated annotations for manually declared count and delete queries.
* DATAMONGO-1538 - Add support for $let to aggregation.
* DATAMONGO-1536 - Add missing aggregation operators.
* DATAMONGO-1535 - Release 2.0 M2 (Kay).
Changes in version 1.9.8.RELEASE (2017-03-02)
---------------------------------------------
* DATAMONGO-1608 - NullPointerException with null argument when using IgnoreCase.

View File

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