|
17 | 17 | package com.mongodb.client;
|
18 | 18 |
|
19 | 19 | import com.mongodb.ExplainVerbosity;
|
| 20 | +import com.mongodb.MongoNamespace; |
20 | 21 | import com.mongodb.annotations.Alpha;
|
21 | 22 | import com.mongodb.annotations.Reason;
|
22 | 23 | import com.mongodb.client.cursor.TimeoutMode;
|
| 24 | +import com.mongodb.client.model.Aggregates; |
23 | 25 | import com.mongodb.client.model.Collation;
|
| 26 | +import com.mongodb.client.model.MergeOptions; |
24 | 27 | import com.mongodb.lang.Nullable;
|
25 | 28 | import org.bson.BsonValue;
|
26 | 29 | import org.bson.Document;
|
|
38 | 41 | public interface AggregateIterable<TResult> extends MongoIterable<TResult> {
|
39 | 42 |
|
40 | 43 | /**
|
41 |
| - * Aggregates documents according to the specified aggregation pipeline, which must end with a $out or $merge stage. |
| 44 | + * Aggregates documents according to the specified aggregation pipeline, which must end with an |
| 45 | + * {@link Aggregates#out(String, String) $out} or {@link Aggregates#merge(MongoNamespace, MergeOptions) $merge} stage. |
| 46 | + * This method is the preferred alternative to {@link #iterator()}, {@link #cursor()}. |
42 | 47 | *
|
43 |
| - * @throws IllegalStateException if the pipeline does not end with a $out or $merge stage |
| 48 | + * @throws IllegalStateException if the pipeline does not end with an {@code $out} or {@code $merge} stage |
44 | 49 | * @mongodb.driver.manual reference/operator/aggregation/out/ $out stage
|
45 | 50 | * @mongodb.driver.manual reference/operator/aggregation/merge/ $merge stage
|
46 | 51 | * @since 3.4
|
47 | 52 | */
|
48 | 53 | void toCollection();
|
49 | 54 |
|
| 55 | + /** |
| 56 | + * Aggregates documents according to the specified aggregation pipeline. |
| 57 | + * <ul> |
| 58 | + * <li> |
| 59 | + * If the aggregation pipeline ends with an {@link Aggregates#out(String, String) $out} or |
| 60 | + * {@link Aggregates#merge(MongoNamespace, MergeOptions) $merge} stage, |
| 61 | + * then {@linkplain MongoCollection#find() finds all} documents in the affected namespace and returns a {@link MongoCursor} |
| 62 | + * over them. You may want to use {@link #toCollection()} instead.</li> |
| 63 | + * <li> |
| 64 | + * Otherwise returns a {@link MongoCursor} producing no elements.</li> |
| 65 | + * </ul> |
| 66 | + */ |
| 67 | + @Override |
| 68 | + MongoCursor<TResult> iterator(); |
| 69 | + |
| 70 | + /** |
| 71 | + * Aggregates documents according to the specified aggregation pipeline. |
| 72 | + * <ul> |
| 73 | + * <li> |
| 74 | + * If the aggregation pipeline ends with an {@link Aggregates#out(String, String) $out} or |
| 75 | + * {@link Aggregates#merge(MongoNamespace, MergeOptions) $merge} stage, |
| 76 | + * then {@linkplain MongoCollection#find() finds all} documents in the affected namespace and returns a {@link MongoCursor} |
| 77 | + * over them. You may want to use {@link #toCollection()} instead.</li> |
| 78 | + * <li> |
| 79 | + * Otherwise returns a {@link MongoCursor} producing no elements.</li> |
| 80 | + * </ul> |
| 81 | + */ |
| 82 | + @Override |
| 83 | + MongoCursor<TResult> cursor(); |
| 84 | + |
50 | 85 | /**
|
51 | 86 | * Enables writing to temporary files. A null value indicates that it's unspecified.
|
52 | 87 | *
|
|
0 commit comments