Query methods can now query for related objects of an entity. Test cases are centered around a Person having an Address. The query is something like:
List<Person> findByAddress(Address address);
We correctly marshal the parameter into a DBObject using the MongoConverter on argument binding.
Exposed the configured MongoConverter at MongoTemplate so that the repository infrastructure gets access to it. Let repository classes work with the template again instead of plain MongoOperations. Removed find(…) method from MongoOperations and -Template. Extended SimpleMongoConverter so that it can unmarshal collections as well.
- MongoRepositoryFactory now validates id type for supported types
- use MongoOperations.find(…) in SimpleMongoRepository.findById(…)
- added integration test for findById(…)
- added integration test for MongoTemplate
- improved signature of MongoReader to return an object of the type handed to it
- added convertObjectId(ObjectId id, Class targetType) to MongoConverter to delegate id conversion to the converter as well
- changed return values of some internal methods from Object to ObjectId where generally nothing else can come out of
- refactored populateIdIfNecessary(…) in MongoTemplate to use MongoConverter to convert the ObjectId created by the insert or save operation
- use field access where possible to avoid the need for setters
- introduced value objects MongoBeanWrapper and MongoPropertyDescriptor to simplify the code
- unpopulated id fields will get populated on marshaling
- support String, ObjectId and BigInteger as id types
- added find(…) method to MongoTemplate that looks up objects by type and id
- moved exception translation from MongoDbUtils to MongoExceptionTranslator
- don't let MongoFactoryBean implement PersistenceExceptionTranslator
- heavily refactored MongoTemplate to let higher level methods use callbacks to centralize exception handling in the callback executing methods
- changed return type of MongoOperations.getCollectionNames to Set<String> as returning a List implies same order, that we can't guarantee actually
- polished JavaDoc of MongoOperations
- added assertions to methods
- changed methods taking a List<Object> to take a List<? extends Object> instead
- added abstract unit test for MongoOperations to define tests regarding expected exception behavior
- let MongoTemplateUnitTests extend MongoOperationsUnitTests
- removed obsolete property in MongoTemplate
- removed obsolete Exception declaration in MongoOoptionsFactoryBean
- use HashMap instead of LinkedHashMap as property in UpdateBuilder
- renamed local variable in MongoEntityinformation not to shadow a field
- reduced visibility of MongoSynchronization and fixed generics
- reduced visibility of MongoDbUtils and make it an abstract non-instantiateable class
- eliminate nested if-clause in MongoDbUtils
- removed obsolete class FluentDbObject
- added serialVersionUID to CannotGetMongoDbConnectionException
- created static inner enum for ObjectId-to-String converter
- added generics to Portfolio test entity
- polished SimpleMongoConverterTests and MvcAnalyticsTest
- removed some unnecessary imports and modifiers
- default converter to SimpleMongoConverter in constructor already
- made potential final members final
- use error message template instead of repeating the same String over and over again
- removed _-prefix from id variables
- extracted "_id" to ID constant
- fixed inevitable NullPointerExceptions in updateFirst(…), updateMulti(…) and remove(…)
- remove special handling of non available username and password in getDb() as MongoDbUtils.getDB already handles them correctly
- removed throws Exception form afterPropertiesSet() as it does not throw any checked exception
- use String as type for passwords at MongoTemplate API and only turn it into the underlying char[] when handing it to MongoDbUtils
- added assertions for mandatory constructor arguments
Added sample for setup and usage as well as samples for query methods and a table of currently supported keywords, samples and the according Mongo query expressions.
Created Mongo specific implementation of basic namespace functionality from Spring Data Commons. Allows classpath scanning for MongoRepository based repository interfaces.
- added CursorCallback to be able to apply limit, skip and sorting to the query execution
- added paged execution for queries and extended SimpleMongoRepository to support paging and sorting as well
- minor JavaDoc polishing.