Tweaked method signatures in MongoRepositoryFactory after some signature changes in Spring Data Commons. Use newly introduced getTragetRepositoryViaReflection(…) to obtain the repository instance via the super class.
Added repositoryBaseClass() attribute to @EnableMongoRepositories.
Related tickets: DATACMNS-542.
If a collection containing null values is handed to MongoTempalte.insertAll(…), a NullPointerException was caused by the unguarded attempt to lookup the class of the element. We now explicitly handle this case and skip the element.
Some code cleanups in MongoTemplate.doInsertAll(…).
Add repository query return types to reference doc.
Fall back to locally available Spring Data Commons reference docs as the remote variant doesn't seem to work currently
Introduced AggregationExpression interface to be able to represent arbitrary MongoDB expressions that can be used in projection and group operations. Supported function expressions are provided via the AggregationFunctionExpressions enum.
Original pull request: #272.
Added the necessary configuration infrastructure to automatically register the GeoJsonModule as Spring bean when @EnableSpringDataWebSupport is used. This is implemented by exposing a configuration class annotated with @SpringDataWebConfigurationMixin.
Added Spring WebMVC as test dependency to be able to write an integration test. Polished GeoJsonModule to hide the actual serializers.
Original pull request: #283.
Related ticket: DATACMNS-660.
Fixed copyright ranges in license headers. Added unit test to PartTreeMongoQueryUnitTests to verify the root exception being propagated correctly.
Original pull request: #280.
Related pull request: #259.
The JSONParseException caught in PartTreeMongoQuery is now passed to the IllegalStateException we throw from the method. Previously it was passed to the String.format(…) varargs. Verified by manually throwing a JSONParseException in the debugger.
Original pull request: #280.
Related pull request: #259.
Moved to newly introduced Range type in Spring Data Commons to more safely bind minimum and maximum distances. Changed internal APIs to always use a Range<Distance> which gets populated based on the method signature's characteristics: if only one Distance parameter is found it's interpreted as a range with upper bound only.
Removed invalid testcase for minDistance on 2D index.
Original pull request: #277.
We now support $minDistance for NearQuery and Criteria. Please keep in mind that minDistance is only available for MongoDB 2.6 and better and can only be combined with $near or $nearSphere operator depending on the defined index type. Usage of $minDistance with NearQuery is only possible when a 2dsphere index is present. We also make sure $minDistance operator gets correctly nested when using GeoJSON types.
It is now possible to use a Range<Distance> parameter within the repository queries. This allows to define near queries like:
findByLocationNear(Point point, Range<Distance> distances);
The lower bound of the range is treated as the minimum distance while the upper one defines the maximum distance from the given point. In case a Distance parameter is provided it will serve as maxDistance.
Original pull request: #277.
AggregationTests.shouldHonorFieldAliasesForFieldReferences() now correctly sets up 3 different instances of MeterData and correctly calculates the aggreated counter values.
Original pull request: #279.
We’ve added special types representing GeoJson structures. This allows to use those within both queries and domain types.
GeoJson types should only be used in combination with a 2dsphere index as 2d index is not able to handle the structure. Though legacy coordinate pairs and GeoJson types can be mixed inside MongoDB, we currently do not support conversion of legacy coordinates to GeoJson types.
Removed ServersideJavaScript abstraction as we still had to resort on instanceof checks and it created more ambiguities than it helped (e.g. in a script with name and code, which of the two get's executed?). We now have an ExecutableMongoScript which is code only and a NamedMongoScript, which basically is the former assigned to a name. Execution can be triggered on the former or a name.
ScriptOperations.exists(…) now returns a primitive boolean to avoid null checks. JavaDoc.
Original pull request: #254.
We added ScriptOperations to MongoTemplate. Those allow storage and execution of java script function directly on the MongoDB server instance. Having ScriptOperations in place builds the foundation for annotation driver support in repository layer.
Original pull request: #254.
Renamed MongoOperations executeAsStream(…) to stream(…). Make use of Spring Data Commons StreamUtils in AbstractMongoQuery's StreamExecution. Moved test case from PersonRepositoryIntegrationTests to AbstractPersonRepositoryIntegrationTests to make sure they're executed for all sub-types.
Original pull request: #274.
MongoFactoryBean, MongoOptionsFactoryBean, MongoClientFactoryBean and MongoClientOptionsFactoryBean now extend AbstractFactoryBean to get a lot of the lifecycle callbacks without further code.
Added non-null assertions to newly introduced methods on MongoOperations/MongoTemplate.
Moved MongoClientVersion into util package. Introduced static imports for ReflectionUtils and MongoClientVersion for all references in the newly introduced Invoker types.
Some formatting, JavaDoc polishes, suppress deprecation warnings. Added build profile for MongoDB Java driver 3.0 as well as the following snapshot.
Original pull request: #273.
We now support mongo-java-driver version 2.x and 3.0 along with MongoDB Server 2.6.7 and 3.0.0.
Please note that some of the configurations options might no longer be valid when used with version 3 of the MongoDB Java driver. Have a look at the table below so see some of the major differences in using version 2.x or 3.0
| 2.x | 3.0
----------------------+----------------------+-----------------------------------------------
default WriteConcern | NONE | UNACKNOWLEDGED
----------------------+----------------------+-----------------------------------------------
option for slaveOk | available | ignored
----------------------+----------------------+-----------------------------------------------
option for autoConnect| available | ignored
----------------------+----------------------+-----------------------------------------------
write result checking | available | ignored (errors are exceptions anyway)
----------------------+----------------------+-----------------------------------------------
rest index cache | available | throws UnsupportedOperationException
----------------------+----------------------+-----------------------------------------------
DBRef resolution | via DBRef.fetch | via collection.findOne
----------------------+----------------------+-----------------------------------------------
MapReduce Options | applied | ignored
----------------------+----------------------+-----------------------------------------------
authentication | via UserCredentials | via MongoClient
----------------------+----------------------+-----------------------------------------------
WriteConcernException | not available | translated to DataIntegretyViolationException
----------------------+----------------------+-----------------------------------------------
executeInSession | available | requestStart/requestDone commands ignored.
----------------------+----------------------+-----------------------------------------------
index creation | via createIndex | via createIndex
----------------------+----------------------+-----------------------------------------------
We need to soften the exception validation a bit since the message is slightly different when using different storage engines in a MongoDB 3.0 environment.
Added an explicit <mongo-client /> element and <client-options /> to the configuration schema. These elements will replace existing <mongo /> and <options /> elements in a subsequent release. Added credentials attribute to <mongo-client /> which allows to define a set of credentials used for setting up the MongoClient correctly using authentication data. We now reject <mongo-options /> configuration when using MongoDB Java driver generation 3.0 and above.
Original pull request: #273.
Movend jconsole.png to the images folder. Extracted MongoDB-specific auditing documentation into separate file for inclusion after the general auditing docs.
Refactored CustomConversions to unify locked access to the cached types. Added a cache for raw-write-targets so that they’re cached, too.
DBObjectAccessor now avoids expensive code paths for both reads and writes in case of simple field names.
MappingMongoConverter now eagerly skips conversions of simple types in case the value is already assignable to the target type.
QueryMapper now checks the ConversionService and only triggers a conversion if it’s actually capable of doing so instead of catching a more expensive exception.
CachingMongoPersistentProperty now also caches usePropertyAccess() and isTransient() as they’re used quite frequently.
Related ticket: DATACMNS-637.