29
29
* make use of low level bulk commands on the protocol level. This interface defines a fluent API to add multiple single
30
30
* operations or list of similar operations in sequence which can then eventually be executed by calling
31
31
* {@link #execute()}.
32
+ *
33
+ * <pre class="code">
34
+ * MongoTemplate template = …;
35
+ *
36
+ * template.bulkOps(BulkMode.UNORDERED, Person.class)
37
+ * .insert(newPerson)
38
+ * .updateOne(where("firstname").is("Joe"), Update.update("lastname", "Doe"))
39
+ * .execute();
40
+ * </pre>
32
41
* <p>
33
42
* Bulk operations are issued as one batch that pulls together all insert, update, and delete operations. Operations
34
43
* that require individual operation results such as optimistic locking (using {@code @Version}) are not supported and
@@ -96,7 +105,7 @@ default BulkOperations updateOne(Query query, Update update) {
96
105
* @param updates Update operations to perform.
97
106
* @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}.
98
107
*/
99
- BulkOperations updateOne (List <Pair <Query , Update >> updates );
108
+ BulkOperations updateOne (List <Pair <Query , UpdateDefinition >> updates );
100
109
101
110
/**
102
111
* Add a single update to the bulk operation. For the update request, all matching documents are updated.
@@ -125,7 +134,7 @@ default BulkOperations updateMulti(Query query, Update update) {
125
134
* @param updates Update operations to perform.
126
135
* @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}.
127
136
*/
128
- BulkOperations updateMulti (List <Pair <Query , Update >> updates );
137
+ BulkOperations updateMulti (List <Pair <Query , UpdateDefinition >> updates );
129
138
130
139
/**
131
140
* Add a single upsert to the bulk operation. An upsert is an update if the set of matching documents is not empty,
@@ -180,7 +189,7 @@ default BulkOperations upsert(Query query, Update update) {
180
189
*
181
190
* @param query Update criteria.
182
191
* @param replacement the replacement document. Must not be {@literal null}.
183
- * @return the current {@link BulkOperations} instance with the replace added, will never be {@literal null}.
192
+ * @return the current {@link BulkOperations} instance with the replacement added, will never be {@literal null}.
184
193
* @since 2.2
185
194
*/
186
195
default BulkOperations replaceOne (Query query , Object replacement ) {
@@ -193,7 +202,7 @@ default BulkOperations replaceOne(Query query, Object replacement) {
193
202
* @param query Update criteria.
194
203
* @param replacement the replacement document. Must not be {@literal null}.
195
204
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
196
- * @return the current {@link BulkOperations} instance with the replace added, will never be {@literal null}.
205
+ * @return the current {@link BulkOperations} instance with the replacement added, will never be {@literal null}.
197
206
* @since 2.2
198
207
*/
199
208
BulkOperations replaceOne (Query query , Object replacement , FindAndReplaceOptions options );
0 commit comments