@@ -307,21 +307,25 @@ Improved Bulk Write Command
307
307
---------------------------
308
308
309
309
Starting with {+mdb-server+} version 8.0 and {+driver-short+} version 5.3, there
310
- is an improved bulk write method, ``MongoClient.bulkWrite()``, that can be used
311
- to write to different databases and collections in the same cluster.
310
+ is an improved bulk write method, ``MongoClient.bulkWrite()``, that writes to
311
+ different databases and collections in the same cluster.
312
312
313
313
In the previous examples on this page, the ``bulkWrite()`` method takes a list
314
- of ``WriteModel`` documents. The specified subclass of ``WriteModel`` represents
315
- the corresponding write operation. For example, ``InsertOneModel`` represents
316
- inserting one document. Similarly, the new ``bulkWrite()`` method takes a
314
+ of ``WriteModel`` documents in which the specified subclass of ``WriteModel``
315
+ represents the corresponding write operation. For example, ``InsertOneModel``
316
+ represents inserting one document.
317
+
318
+ Similarly, the new ``bulkWrite()`` method takes a
317
319
list of ``ClientNamespacedWriteModel`` objects to represent the write operation.
318
320
However, you do not need to specify the subclass that represents the corresponding
319
321
write operation. Instead, the ``ClientNamespacedWriteModel`` object contains different
320
322
methods to represent different write operations, such as ``insertOne()`` or
321
- ``updateOne()``. These methods take a ``MongoNamespace object that defines which
322
- database and collection to write to and a ``Document`` object that defines the
323
+ ``updateOne()``.
324
+
325
+ These methods take a ``MongoNamespace`` object that defines which
326
+ database and collection to write to, and a ``Document`` object that defines the
323
327
document information. Some methods, such as ``updateOne()`` and ``replaceOne()``,
324
- also take a ``filter `` object.
328
+ also take a ``Filters `` object that defines the filter for the operation .
325
329
326
330
The following sections describe how to use the new ``bulkWrite()`` method.
327
331
@@ -400,11 +404,11 @@ The following code shows how to use the ``ordered()`` method on the
400
404
``ClientBulkWriteOptions`` object.
401
405
402
406
.. code-block:: java
407
+
403
408
MongoNamespace namespace = new MongoNamespace("db", "people");
404
409
405
410
ClientBulkWriteOptions options = new ClientBulkWriteOptions().ordered(false);
406
411
407
-
408
412
ClientBulkWriteResult result = client.bulkWrite(List<>(
409
413
ClientNamespacedWriteModel.insertOne(namespace, new Document("name", "Donkey Kong")),
410
414
ClientNamespacedWriteModel.insertOne(namespace, new Document("name", "Mario"))
0 commit comments