@@ -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,8 +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
*/
108
+ @ Deprecated (since = "4.5.1" , forRemoval = true )
106
109
public OutOperation uniqueKey (@ Nullable String key ) {
107
110
108
111
Document uniqueKey = key == null ? null : BsonUtils .toDocumentOrElse (key , it -> new Document (it , 1 ));
@@ -126,8 +129,10 @@ public OutOperation uniqueKey(@Nullable String key) {
126
129
* @param fields must not be {@literal null}.
127
130
* @return new instance of {@link OutOperation}.
128
131
* @since 2.2
129
- * @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.
130
134
*/
135
+ @ Deprecated (since = "4.5.1" , forRemoval = true )
131
136
public OutOperation uniqueKeyOf (Iterable <String > fields ) {
132
137
133
138
Assert .notNull (fields , "Fields must not be null" );
@@ -145,8 +150,10 @@ public OutOperation uniqueKeyOf(Iterable<String> fields) {
145
150
* @param mode must not be {@literal null}.
146
151
* @return new instance of {@link OutOperation}.
147
152
* @since 2.2
148
- * @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.
149
155
*/
156
+ @ Deprecated (since = "4.5.1" , forRemoval = true )
150
157
public OutOperation mode (OutMode mode ) {
151
158
152
159
Assert .notNull (mode , "Mode must not be null" );
@@ -160,8 +167,10 @@ public OutOperation mode(OutMode mode) {
160
167
* @return new instance of {@link OutOperation}.
161
168
* @see OutMode#REPLACE_COLLECTION
162
169
* @since 2.2
163
- * @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.
164
172
*/
173
+ @ Deprecated (since = "4.5.1" , forRemoval = true )
165
174
public OutOperation replaceCollection () {
166
175
return mode (OutMode .REPLACE_COLLECTION );
167
176
}
@@ -173,8 +182,10 @@ public OutOperation replaceCollection() {
173
182
* @return new instance of {@link OutOperation}.
174
183
* @see OutMode#REPLACE
175
184
* @since 2.2
176
- * @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.
177
187
*/
188
+ @ Deprecated (since = "4.5.1" , forRemoval = true )
178
189
public OutOperation replaceDocuments () {
179
190
return mode (OutMode .REPLACE );
180
191
}
@@ -186,16 +197,18 @@ public OutOperation replaceDocuments() {
186
197
* @return new instance of {@link OutOperation}.
187
198
* @see OutMode#INSERT
188
199
* @since 2.2
189
- * @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.
190
202
*/
203
+ @ Deprecated (since = "4.5.1" , forRemoval = true )
191
204
public OutOperation insertDocuments () {
192
205
return mode (OutMode .INSERT );
193
206
}
194
207
195
208
@ Override
196
209
public Document toDocument (AggregationOperationContext context ) {
197
210
198
- if (!requiresMongoDb42Format ()) {
211
+ if (!requiresExtendedFormat ()) {
199
212
if (!StringUtils .hasText (databaseName )) {
200
213
return new Document (getOperator (), collectionName );
201
214
}
@@ -223,7 +236,7 @@ public String getOperator() {
223
236
return "$out" ;
224
237
}
225
238
226
- private boolean requiresMongoDb42Format () {
239
+ private boolean requiresExtendedFormat () {
227
240
return mode != null || uniqueKey != null ;
228
241
}
229
242
@@ -232,9 +245,10 @@ private boolean requiresMongoDb42Format() {
232
245
*
233
246
* @author Christoph Strobl
234
247
* @since 2.2
235
- * @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.
236
250
*/
237
- @ Deprecated
251
+ @ Deprecated ( since = "4.5.1" , forRemoval = true )
238
252
public enum OutMode {
239
253
240
254
/**
@@ -248,7 +262,8 @@ public enum OutMode {
248
262
REPLACE ("replaceDocuments" ),
249
263
250
264
/**
251
- * 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.
252
267
*/
253
268
REPLACE_COLLECTION ("replaceCollection" );
254
269
0 commit comments