-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Improve the toCollection
and related API documentation
#1677
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,15 +17,19 @@ | |
package com.mongodb.reactivestreams.client; | ||
|
||
import com.mongodb.ExplainVerbosity; | ||
import com.mongodb.MongoNamespace; | ||
import com.mongodb.annotations.Alpha; | ||
import com.mongodb.annotations.Reason; | ||
import com.mongodb.client.cursor.TimeoutMode; | ||
import com.mongodb.client.model.Aggregates; | ||
import com.mongodb.client.model.Collation; | ||
import com.mongodb.client.model.MergeOptions; | ||
import com.mongodb.lang.Nullable; | ||
import org.bson.BsonValue; | ||
import org.bson.Document; | ||
import org.bson.conversions.Bson; | ||
import org.reactivestreams.Publisher; | ||
import org.reactivestreams.Subscriber; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
|
@@ -83,13 +87,31 @@ public interface AggregatePublisher<TResult> extends Publisher<TResult> { | |
AggregatePublisher<TResult> bypassDocumentValidation(@Nullable Boolean bypassDocumentValidation); | ||
|
||
/** | ||
* Aggregates documents according to the specified aggregation pipeline, which must end with a $out stage. | ||
* Aggregates documents according to the specified aggregation pipeline, which must end with an | ||
* {@link Aggregates#out(String, String) $out} or {@link Aggregates#merge(MongoNamespace, MergeOptions) $merge} stage. | ||
* Calling this method and then {@linkplain Publisher#subscribe(Subscriber) subscribing} to the returned {@link Publisher} | ||
* is a preferred alternative to {@linkplain #subscribe(Subscriber) subscribing} to this {@link AggregatePublisher}. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we expand on why this is currently a preferred alternative? IMO It's unclear to the end user... Maybe mention that in the next major we will remove the implicit |
||
* | ||
* @throws IllegalStateException if the pipeline does not end with an {@code $out} or {@code $merge} stage | ||
* @return an empty publisher that indicates when the operation has completed | ||
* @mongodb.driver.manual aggregation/ Aggregation | ||
*/ | ||
Publisher<Void> toCollection(); | ||
|
||
/** | ||
* Requests {@link AggregatePublisher} to start streaming data according to the specified aggregation pipeline. | ||
* <ul> | ||
* <li> | ||
* If the aggregation pipeline ends with an {@link Aggregates#out(String, String) $out} or | ||
* {@link Aggregates#merge(MongoNamespace, MergeOptions) $merge} stage, | ||
* then {@linkplain MongoCollection#find() finds all} documents in the affected namespace and produces them. | ||
* You may want to use {@link #toCollection()} instead.</li> | ||
* <li> | ||
* Otherwise, produces no elements.</li> | ||
* </ul> | ||
*/ | ||
void subscribe(Subscriber<? super TResult> s); | ||
|
||
/** | ||
* Sets the collation options | ||
* | ||
|
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.
Note to others that these docs and some others are new, and therefore non-trivial.