-
Notifications
You must be signed in to change notification settings - Fork 1.1k
DATAMONGO-2089 - Add fluent change stream API to ReactiveMongoTemplate. #751
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
Conversation
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.
Let's also add Kotlin extensions for reified generics and for the as
-> asType
method.
* | ||
* @return new instance of {@link ReactiveFind}. Never {@literal null}. | ||
*/ | ||
ReactiveChangeStream<Document> changeStream(); |
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.
Should we drop this method in favor of changeStream(Document.class)
?
* @see ChangeStreamOptionsBuilder#resumeAt(BsonTimestamp) | ||
* @throws IllegalArgumentException if the given beacon is neither {@link Instant} nor {@link BsonTimestamp}. | ||
*/ | ||
TerminatingChangeStream<T> resumeAt(Object beacon); |
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.
Nit: token
, not beacon
.
* Consider limiting events be defining a {@link ChangeStreamWithCollection#watchCollection(String) collection} and/or | ||
* {@link ChangeStreamWithFilter#filter(CriteriaDefinition) filter}. | ||
* | ||
* @return new instance of {@link ReactiveFind}. Never {@literal null}. |
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.
Nit: ReactiveChangeStream
instead of ReactiveFind
.
/** | ||
* Result type override (optional). | ||
*/ | ||
interface ChangeStreamWithProjection<T> extends ChangeStreamWithFilter<T> { |
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.
Probably we should inline this interface into ChangeStreamWithFilter
. ChangeStreamWithFilter.filter
returns ChangeStreamWithProjection
and as(…)
returns ChangeStreamWithFilter
.
We now offer a fluent API for more intuitive change stream interaction. Flux<ChangeStreamEvent<User>> flux = reactiveTemplate.changeStream() .watchCollection("persons") .filter(where("age").gte(38)) .as(User.class) .listen();
eeec44f
to
03531a2
Compare
We now offer a fluent API for more intuitive change stream interaction. Flux<ChangeStreamEvent<User>> flux = reactiveTemplate.changeStream(User.class) .watchCollection("people") .filter(where("age").gte(38)) .listen(); Original pull request: #751.
Add watchCollection(…) accepting an entity class. Use static import for assertions. Tweak javadoc. Original pull request: #751.
That's merged and polished now. |
We now offer a fluent API for more intuitive change stream interaction.