File tree Expand file tree Collapse file tree 8 files changed +36
-4
lines changed
driver-core/src/main/com/mongodb/client/model
driver-reactive-streams/src/main/com/mongodb/reactivestreams/client
driver-scala/src/main/scala/org/mongodb/scala
driver-sync/src/main/com/mongodb/client Expand file tree Collapse file tree 8 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ public Bson getProjection() {
59
59
* @param projection the project document, which may be null.
60
60
* @return this
61
61
* @mongodb.driver.manual tutorial/project-fields-from-query-results Projection
62
+ * @see Projections
62
63
*/
63
64
public FindOneAndDeleteOptions projection (@ Nullable final Bson projection ) {
64
65
this .projection = projection ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ public Bson getProjection() {
62
62
* @param projection the project document, which may be null.
63
63
* @return this
64
64
* @mongodb.driver.manual tutorial/project-fields-from-query-results Projection
65
+ * @see Projections
65
66
*/
66
67
public FindOneAndReplaceOptions projection (@ Nullable final Bson projection ) {
67
68
this .projection = projection ;
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ public Bson getProjection() {
64
64
* @param projection the project document, which may be null.
65
65
* @return this
66
66
* @mongodb.driver.manual tutorial/project-fields-from-query-results Projection
67
+ * @see Projections
67
68
*/
68
69
public FindOneAndUpdateOptions projection (@ Nullable final Bson projection ) {
69
70
this .projection = projection ;
Original file line number Diff line number Diff line change @@ -52,8 +52,20 @@ private Projections() {
52
52
}
53
53
54
54
/**
55
- * Creates a projection of a field whose value is computed from the given expression. Projection with an expression is only supported
56
- * using the $project aggregation pipeline stage.
55
+ * Creates a projection of a field whose value is computed from the given expression. Projection with an expression can be used in the
56
+ * following contexts:
57
+ * <ul>
58
+ * <li>$project aggregation pipeline stage.</li>
59
+ * <li>Starting from MongoDB 4.4, it's also accepted in various find-related methods within the
60
+ * {@code MongoCollection}-based API where projection is supported, for example:
61
+ * <ul>
62
+ * <li>{@code find()}</li>
63
+ * <li>{@code findOneAndReplace()}</li>
64
+ * <li>{@code findOneAndUpdate()}</li>
65
+ * <li>{@code findOneAndDelete()}</li>
66
+ * </ul>
67
+ * </li>
68
+ * </ul>
57
69
*
58
70
* @param fieldName the field name
59
71
* @param expression the expression
Original file line number Diff line number Diff line change 19
19
import com .mongodb .CursorType ;
20
20
import com .mongodb .ExplainVerbosity ;
21
21
import com .mongodb .client .model .Collation ;
22
+ import com .mongodb .client .model .Projections ;
22
23
import com .mongodb .lang .Nullable ;
23
24
import org .bson .BsonValue ;
24
25
import org .bson .Document ;
@@ -104,6 +105,7 @@ public interface FindPublisher<TResult> extends Publisher<TResult> {
104
105
* @param projection the project document, which may be null.
105
106
* @return this
106
107
* @mongodb.driver.manual reference/method/db.collection.find/ Projection
108
+ * @see Projections
107
109
*/
108
110
FindPublisher <TResult > projection (@ Nullable Bson projection );
109
111
/**
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ case class FindObservable[TResult](private val wrapped: FindPublisher[TResult])
121
121
* [[https://www.mongodb.com/docs/manual/reference/method/db.collection.find/ Projection ]]
122
122
* @param projection the project document, which may be null.
123
123
* @return this
124
+ * @see [[org.mongodb.scala.model.Projections ]]
124
125
*/
125
126
def projection (projection : Bson ): FindObservable [TResult ] = {
126
127
wrapped.projection(projection)
Original file line number Diff line number Diff line change @@ -32,8 +32,20 @@ import org.mongodb.scala.bson.conversions.Bson
32
32
object Projections {
33
33
34
34
/**
35
- * Creates a projection of a field whose value is computed from the given expression. Projection with an expression is only supported
36
- * using the `\$project` aggregation pipeline stage.
35
+ * Creates a projection of a field whose value is computed from the given expression. Projection with an expression can be used in the
36
+ * following contexts:
37
+ * <ul>
38
+ * <li>$project aggregation pipeline stage.</li>
39
+ * <li>Starting from MongoDB 4.4, it's also accepted in various find-related methods within the
40
+ * `MongoCollection`-based API where projection is supported, for example:
41
+ * <ul>
42
+ * <li>`find()`</li>
43
+ * <li>`findOneAndReplace()`</li>
44
+ * <li>`findOneAndUpdate()`</li>
45
+ * <li>`findOneAndDelete()`</li>
46
+ * </ul>
47
+ * </li>
48
+ * </ul>
37
49
*
38
50
* @param fieldName the field name
39
51
* @param expression the expression
Original file line number Diff line number Diff line change 19
19
import com .mongodb .CursorType ;
20
20
import com .mongodb .ExplainVerbosity ;
21
21
import com .mongodb .client .model .Collation ;
22
+ import com .mongodb .client .model .Projections ;
22
23
import com .mongodb .lang .Nullable ;
23
24
import org .bson .BsonValue ;
24
25
import org .bson .Document ;
@@ -96,6 +97,7 @@ public interface FindIterable<TResult> extends MongoIterable<TResult> {
96
97
* @param projection the project document, which may be null.
97
98
* @return this
98
99
* @mongodb.driver.manual reference/method/db.collection.find/ Projection
100
+ * @see Projections
99
101
*/
100
102
FindIterable <TResult > projection (@ Nullable Bson projection );
101
103
You can’t perform that action at this time.
0 commit comments