@@ -49,7 +49,8 @@ public OutOperation(String outCollectionName) {
49
49
/**
50
50
* @param databaseName Optional database name the target collection is located in. Can be {@literal null}.
51
51
* @param collectionName Collection name to export the results. Must not be {@literal null}. Can be {@literal null}.
52
- * @param uniqueKey Optional unique key spec identify a document in the to collection for replacement or merge.
52
+ * @param uniqueKey Optional unique key spec identify a document in the {@code to} collection for replacement or
53
+ * merge.
53
54
* @param mode The mode for merging the aggregation pipeline output with the target collection. Can be
54
55
* {@literal null}. {@literal null}.
55
56
* @since 2.2
@@ -101,9 +102,10 @@ public OutOperation in(@Nullable String database) {
101
102
* @param key can be {@literal null}. Server uses {@literal _id} when {@literal null}.
102
103
* @return new instance of {@link OutOperation}.
103
104
* @since 2.2
104
- * @deprecated no longer applicable for MongoDB 5+
105
+ * @deprecated extended {@code $out} syntax was superseded by {@code $merge}. Support for the extended syntax has been
106
+ * removed with MongoDB 5, use {@link MergeOperation} instead.
105
107
*/
106
- @ Deprecated
108
+ @ Deprecated ( since = "4.3.13" )
107
109
public OutOperation uniqueKey (@ Nullable String key ) {
108
110
109
111
Document uniqueKey = key == null ? null : BsonUtils .toDocumentOrElse (key , it -> new Document (it , 1 ));
@@ -127,9 +129,10 @@ public OutOperation uniqueKey(@Nullable String key) {
127
129
* @param fields must not be {@literal null}.
128
130
* @return new instance of {@link OutOperation}.
129
131
* @since 2.2
130
- * @deprecated no longer applicable for MongoDB 5+
132
+ * @deprecated extended {@code $out} syntax was superseded by {@code $merge}. Support for the extended syntax has been
133
+ * removed with MongoDB 5, use {@link MergeOperation} instead.
131
134
*/
132
- @ Deprecated
135
+ @ Deprecated ( since = "4.3.13" )
133
136
public OutOperation uniqueKeyOf (Iterable <String > fields ) {
134
137
135
138
Assert .notNull (fields , "Fields must not be null" );
@@ -147,9 +150,10 @@ public OutOperation uniqueKeyOf(Iterable<String> fields) {
147
150
* @param mode must not be {@literal null}.
148
151
* @return new instance of {@link OutOperation}.
149
152
* @since 2.2
150
- * @deprecated no longer applicable for MongoDB 5+
153
+ * @deprecated extended {@code $out} syntax was superseded by {@code $merge}. Support for the extended syntax has been
154
+ * removed with MongoDB 5, use {@link MergeOperation} instead.
151
155
*/
152
- @ Deprecated
156
+ @ Deprecated ( since = "4.3.13" )
153
157
public OutOperation mode (OutMode mode ) {
154
158
155
159
Assert .notNull (mode , "Mode must not be null" );
@@ -163,9 +167,10 @@ public OutOperation mode(OutMode mode) {
163
167
* @return new instance of {@link OutOperation}.
164
168
* @see OutMode#REPLACE_COLLECTION
165
169
* @since 2.2
166
- * @deprecated no longer applicable for MongoDB 5+
170
+ * @deprecated extended {@code $out} syntax was superseded by {@code $merge}. Support for the extended syntax has been
171
+ * removed with MongoDB 5, use {@link MergeOperation} instead.
167
172
*/
168
- @ Deprecated
173
+ @ Deprecated ( since = "4.3.13" )
169
174
public OutOperation replaceCollection () {
170
175
return mode (OutMode .REPLACE_COLLECTION );
171
176
}
@@ -177,9 +182,10 @@ public OutOperation replaceCollection() {
177
182
* @return new instance of {@link OutOperation}.
178
183
* @see OutMode#REPLACE
179
184
* @since 2.2
180
- * @deprecated no longer applicable for MongoDB 5+
185
+ * @deprecated extended {@code $out} syntax was superseded by {@code $merge}. Support for the extended syntax has been
186
+ * removed with MongoDB 5, use {@link MergeOperation} instead.
181
187
*/
182
- @ Deprecated
188
+ @ Deprecated ( since = "4.3.13" )
183
189
public OutOperation replaceDocuments () {
184
190
return mode (OutMode .REPLACE );
185
191
}
@@ -191,17 +197,18 @@ public OutOperation replaceDocuments() {
191
197
* @return new instance of {@link OutOperation}.
192
198
* @see OutMode#INSERT
193
199
* @since 2.2
194
- * @deprecated no longer applicable for MongoDB 5+
200
+ * @deprecated extended {@code $out} syntax was superseded by {@code $merge}. Support for the extended syntax has been
201
+ * removed with MongoDB 5, use {@link MergeOperation} instead.
195
202
*/
196
- @ Deprecated
203
+ @ Deprecated ( since = "4.3.13" )
197
204
public OutOperation insertDocuments () {
198
205
return mode (OutMode .INSERT );
199
206
}
200
207
201
208
@ Override
202
209
public Document toDocument (AggregationOperationContext context ) {
203
210
204
- if (!requiresMongoDb42Format ()) {
211
+ if (!requiresExtendedFormat ()) {
205
212
if (!StringUtils .hasText (databaseName )) {
206
213
return new Document (getOperator (), collectionName );
207
214
}
@@ -229,7 +236,7 @@ public String getOperator() {
229
236
return "$out" ;
230
237
}
231
238
232
- private boolean requiresMongoDb42Format () {
239
+ private boolean requiresExtendedFormat () {
233
240
return mode != null || uniqueKey != null ;
234
241
}
235
242
@@ -238,9 +245,10 @@ private boolean requiresMongoDb42Format() {
238
245
*
239
246
* @author Christoph Strobl
240
247
* @since 2.2
241
- * @deprecated no longer applicable for MongoDB 5+
248
+ * @deprecated extended {@code $out} syntax was superseded by {@code $merge}. Support for the extended syntax has been
249
+ * removed with MongoDB 5, use {@link MergeOperation} instead.
242
250
*/
243
- @ Deprecated
251
+ @ Deprecated ( since = "4.3.13" )
244
252
public enum OutMode {
245
253
246
254
/**
@@ -254,7 +262,8 @@ public enum OutMode {
254
262
REPLACE ("replaceDocuments" ),
255
263
256
264
/**
257
- * Replaces the to collection with the output from the aggregation pipeline. Cannot be in a different database.
265
+ * Replaces the {@code to} collection with the output from the aggregation pipeline. Cannot be in a different
266
+ * database.
258
267
*/
259
268
REPLACE_COLLECTION ("replaceCollection" );
260
269
0 commit comments