-
Notifications
You must be signed in to change notification settings - Fork 1.1k
DATAMONGO-1176 - Add support for reactive data access. #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4294eca
to
65f8fc7
Compare
47fc9eb
to
37b26bb
Compare
dee43f7
to
e912e50
Compare
mp911de
commented
Oct 31, 2016
/* (non-Javadoc) | ||
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#save(java.lang.Object) | ||
*/ | ||
public <T> Mono<T> save(T objectToSave) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should check that T
is not a collection/Publisher
. Otherwise, it's very easy to pass in objects that are not intended for saving (save(Flux.just(…)
).
…ated, non-ObjectId on batch inserts. The methods in MongoTemplate inserting a batch of documents previously only returned database generated identifiers, more especially ObjectId ones. This caused non-ObjectId identifiers potentially generated by other parties — i.e. an event listener reacting to a BeforeSaveEvent — not being considered for source object identifier population. This commit adds a workaround augmenting the list of database generated identifiers with the ones actually present in the documents to be inserted. A follow-up ticket DATAMONGO-1519 was created to track the removal of the workaround in favor of a proper fix unfortunately requiring a change in public API (so a 2.0 candidate only). Related tickets: DATAMONGO-1519.
We now make sure to comply to the API requirements of mongo-java-driver 3.4 (in current beta1) by using empty DBObjects instead of null, ignoring non appropriate replication settings and cleaning up tests after execution. Original pull request: #394.
… field spec. We now make sure not to eagerly attempt to convert given query parameters into a mongo specific format by calling toString() the query object, but rather delegate this to another step later in the chain. Original pull request: #404.
Deprecated the one taking an int.
e6a3815
to
e06ab80
Compare
We now use more type information to create a better empty collection in the first place. The previous algorithm always used an empty HashSet plus a subsequent conversion using the raw collection type. Especially the latter caused problems for EnumSets as the conversion into one requires the presence of component type information. We now use Spring's collection factory and more available type information to create a proper collection in the first place and only rely on a subsequent conversion for arrays.
beac4af
to
03eba87
Compare
6f302e8
to
411f2d3
Compare
Upgraded to Spring Data Build parent 2.0 snapshots and Spring Data Commons 2.0 snapshots. Removed obsolete distribution key property. Removed obsolete template.mf.
…h Spring 5 baseline. Upgrade: * Hibernate Validator to 5.2.4.Final * JPA API to 2.1.1 * Hibernate Core to 5.2.1.Final
Prepare issue branch.
We use the Document API when interacting with the MongoDB Java Driver. This allows us to make use of new features and enables us to use the Codec API and prepares the project for future enhancements concerning the drivers the reactive API.
- Remove dropDups assertion as the MongoDB 3 driver does no longer provide dropDups even if running agains a MongoDB v2.6.7. - Remove mongo-next build profile as we're based on the Mongo 3 driver now. - Map update object and merge set operations.
- Update licenses headers. - Renname variables and methods from dbo -> document. - Remove deprecations. - Remove unused code blocks. - Upgrade to MongoDB Java Driver 3.3
Replace DbObject in documentation with Document. Fix typos. Change dbObject variable names to document. Improve error messages. Remove unused code.
Replace DbObject in documentation with Document. Fix typos. Change dbObject variable names to document.
Prepare issue branch.
Reactive MongoDB repository can now be composed from Project Reactor and RxJava types for method arguments and return types. Query methods and methods from the base/implementation classes can be invoked with a conversion of input/output types.
- Update Javadoc comments and reference documentation. - Introduce Adapter for blocking IndexOperations. - Remove transaction synchronization. - Remove unused types. - Remove dropDupos options from indexes. - Prevent usage of Querydsl along with reactive repository. - Use ReactiveQueryMethod in ReactiveMongoQuery.
- Adopt RxJava to RxJava1 repository interface renaming. - Remove ReactiveChunk, Slice and Page. - Update documentation. - Prevent sliced/paged query execution.
Accept Mono<Collection<T>> instead of Publisher<T> to get rid of hidden buffer call inside of MongoTemplate.
…or blocking repository usage. Use ReactiveWrapperConverters for reactive wrapper type conversion to not require Project Reactor for blocking repository usage.
Removed unused references to ConversionService from repository query implementations.
…ation. We now use the newly introduced ….useRepositoryConfiguration(…) in the module specific RepositoryConfigurationExtension implementations to distinguish between reactive and non-reactive repositories. Removed RepositoryType class as it was only used by the previous repository typ detection.
…tions.insertAll(…).
411f2d3
to
655dea4
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We now support reactive data access with Spring Data MongoDB using MongoDB's ReactiveStreams driver. Blocking and reactive data access require two drivers hence two connections are required that require configuration of each driver with their according
MongoTemplate
/ReactiveMongoTemplate
.ReactiveMongoTemplate
uses Project Reactor wrapper typesMono
andFlux
to implementReactiveMongoTemplate
and repository support. Reactive template supports common operations such as:find
methods (by Id, by Query)findAndModify
andfindAndRemove
methodsNot supported:
Reactive Repository support is built on top of
ReactiveMongoTemplate
usingReactiveMongoRepository
as the store-specific base repository. Reactive repositories are enabled by using@EnableReactiveMongoRepositories
on a@Configuration
class to opt-in for reactive support. Reactive repositories can be composed of a reactive base interface such asReactiveCrudRepository
ReactiveSortingRepository
RxJava1CrudRepository
RxJava1SortingRepository
and are identified as reactive repository if one method uses a reactive wrapper type (such as
Flux
orObservable
). If a reactive repository is discovered, it's not implemented by the blocking repository support but with the reactive repository factory. Blocking methods are not (yet) synchronized when using a reactive repository so each repository method must use a reactive wrapper result type. Reactive repository support with Spring Data allows using RxJava1 and Project Reactor types to declare repository methods. Reactive wrapper types are internally converted so the composition library choice on repository level is left up to the user.Reactive MongoDB repository feature coverage is similar to blocking repository support:
Flux<T>
andFlux<GeoResult<T>>
withoutGeoPage
/GeoResults
support)Related ticket: DATAMONGO-1444
Dependencies: