@@ -30,10 +30,9 @@ operations. You can perform bulk write operations at the following levels:
30
30
- :ref:`Collection Level <java-sync-coll-bulk-write>`: You can use the
31
31
``MongoCollection.bulkWrite()`` method to perform bulk write operations on a
32
32
single collection. This method groups write operations together by the kind
33
- of operation. For example, ``MongoCollection.bulkWrite()`` puts multiple insert
34
- operations, including ``insertOne()`` and ``insertMany()``, in the same call,
35
- but will make two calls to the database for an insert operation and a replace
36
- operation.
33
+ of operation. For example, ``MongoCollection.bulkWrite()`` puts multiple update
34
+ operations in the same call, but makes two calls to the database for an insert
35
+ operation and a replace operation.
37
36
38
37
- :ref:`Client Level <java-sync-client-bulk-write>`: When running {+mdb-server+}
39
38
version 8.0 or later, you can use the ``MongoClient.bulkWrite()`` method to perform
@@ -45,17 +44,18 @@ operations. You can perform bulk write operations at the following levels:
45
44
Collection Bulk Write
46
45
---------------------
47
46
48
- Bulk operations consist of many write operations. The
49
- ``MongoCollection.bulkWrite()`` method splits operations of different kinds into
50
- different batches. For example, when the method is passed an ``insertOne()``,
51
- ``insertMany()``, and ``replaceOne()`` operation, it will split the insert operations
52
- into one batch and the replace operation into another. During this process,
53
- the client may reorder operations for efficiency.
54
-
55
- To perform a bulk operation at the collection level, pass a ``List`` of ``WriteModel``
56
- documents to the ``MongoCollection.bulkWrite()`` method. A ``WriteModel`` is a model that
47
+ Bulk operations consist of many write operations. To perform a bulk operation
48
+ at the collection level, pass a ``List`` of ``WriteModel`` documents to the
49
+ ``MongoCollection.bulkWrite()`` method. A ``WriteModel`` is a model that
57
50
represents any of the write operations.
58
51
52
+ The ``MongoCollection.bulkWrite()`` method splits operations of different kinds into
53
+ different batches. For example, when you pass ``DeleteOneModel``,
54
+ ``DeleteManyModel``, and ``ReplaceOneModel`` operations to the method, the method
55
+ splits the delete operations into one batch and the replace operation
56
+ into another. During this process, the client might reorder operations for
57
+ efficiency if the bulk operation is not ordered.
58
+
59
59
The following sections show how to create and use each ``WriteModel``
60
60
document. The examples in each section use the following documents in the
61
61
``people`` collection:
@@ -336,11 +336,23 @@ list of ``ClientNamespacedWriteModel`` instances to represent different write op
336
336
For example, an instance of ``ClientNamespacedInsertOneModel`` represents an
337
337
operation to insert one document.
338
338
339
- You can construct these ``ClientNamespacedWriteModel`` instances using different
340
- methods to represent write operations. ``ClientNamespacedWriteModel`` contains
341
- the methods ``insertOne()``, ``updateOne()``, ``updateMany()``, ``replaceOne()``,
342
- ``deleteOne()``, and ``deleteMany()``. These methods are used to construct corresponding
343
- write models. For example, ``ClientNamespacedWriteModel.updateOne()`` is used to
339
+ You can construct instances of ``ClientNamespacedWriteModel`` using the following
340
+ methods:
341
+
342
+ - ``insertOne()``
343
+
344
+ - ``updateOne()``
345
+
346
+ - ``updateMany()``
347
+
348
+ - ``replaceOne()``
349
+
350
+ - ``deleteOne()``
351
+
352
+ - ``deleteMany()``
353
+
354
+ These methods are used to construct corresponding write models.
355
+ For example, ``ClientNamespacedWriteModel.updateOne()`` is used to
344
356
construct a ``ClientNamespacedUpdateOneModel`` instance, which represents an
345
357
update operation.
346
358
0 commit comments