@@ -18,21 +18,21 @@ MongoDB Java Driver.
1818
1919To perform a single create, replace, update, or delete operation, you can use
2020the corresponding method. For example, to insert one document and replace one
21- document, you can use the ``insertOne()`` and ``replaceOne()`` methods. The
22- ``MongoClient`` makes a call to the database for each operation. You can reduce
23- the number of calls to one by using bulk write operations.
21+ document, you can use the ``insertOne()`` and ``replaceOne()`` methods. In this
22+ case, the ``MongoClient`` makes a call to the database for each operation.
23+ You can reduce the number of calls to one by using bulk write operations.
2424
2525You can perform bulk write operations by using the bulk write API in the
26- {+driver-short+} driver to perform multiple data changes in one call. You can
26+ {+driver-short+} to perform multiple data changes in one call. You can
2727perform bulk operations at the following levels:
2828
2929- :ref:`Collection Level <java-sync-coll-bulk-write>`: You can use the
30- ``MongoCollection.bulkWrite()`` API to perform bulk write operations on a
31- collection.
30+ ``MongoCollection.bulkWrite()`` method to perform bulk write operations on a
31+ single collection.
3232
33- - :ref:`Client Level <java-sync-client-bulk-write>`: In {+mdb-server+} version
34- 8.0 or later, you can use the ``MongoClient.bulkWrite()`` API to perform bulk write
35- operations on multiple collections and databases in the same cluster.
33+ - :ref:`Client Level <java-sync-client-bulk-write>`: When running {+mdb-server+}
34+ version 8.0 or later, you can use the ``MongoClient.bulkWrite()`` method to perform
35+ bulk write operations on multiple collections and databases in the same cluster.
3636
3737.. _java-sync-coll-bulk-write:
3838
@@ -320,11 +320,14 @@ instance of ``InsertOneModel`` represents an operation to insert one document.
320320
321321Similarly, the ``MongoClient.bulkWrite()`` method takes a
322322list of ``ClientNamespacedWriteModel`` instances to represent different write operations.
323- However, it is not necessary to specify the subclass that represents the corresponding
324- write operation. Instead, the ``ClientNamespacedWriteModel`` object contains different
325- methods to represent different write operations, such as ``ClientNamespacedWriteModel.insertOne()`` or
323+ Instead of selecting a specific subclass for each write operation, the
324+ ``ClientNamespacedWriteModel`` object contains different methods to represent
325+ write operations, such as ``ClientNamespacedWriteModel.insertOne()`` or
326326``ClientNamespacedWriteModel.updateOne()``.
327327
328+ ``ClientNamespacedWriteModel`` contains the methods ``insertOne()``, ``updateOne()``,
329+ ``updateMany()``, ``replaceOne()``, ``deleteOne()``, and ``deleteMany()``.
330+
328331These methods take a ``MongoNamespace`` object that defines which
329332database and collection to write to, and a ``Document`` object that defines
330333information about the write operation. Some methods, such as ``updateOne()`` and
@@ -416,8 +419,8 @@ By default, the driver performs write operations in the order that you specify t
416419an error occurs, or until they execute successfully. However, you can pass
417420``false`` to the ``ordered()`` method on the ``ClientBulkWriteOptions``
418421interface to perform write operations in an unordered way. When using the unordered
419- option, an error-producing operation does not block execution of other bulk
420- write operations.
422+ option, an error-producing operation does not block execution of other write
423+ operations in the call to the ``bulkWrite()`` method .
421424
422425The following code sets the ``ordered()`` method on an
423426instance of ``ClientBulkWriteOptions`` and performs a bulk write operation to
@@ -431,7 +434,7 @@ insert multiple documents.
431434
432435 List<ClientNamespacedWriteModel> bulkOperations = new ArrayList<>();
433436
434- bulkOperations.add(ClientNamespacedWriteModel.insertOne(namespace, new Document("_id", 1).append("name", "Rudra Suraj)));
437+ bulkOperations.add(ClientNamespacedWriteModel.insertOne(namespace, new Document("_id", 1).append("name", "Rudra Suraj" )));
435438
436439 // Causes a duplicate key error
437440 bulkOperations.add(ClientNamespacedWriteModel.insertOne(namespace, new Document("_id", 1).append("name", "Mario Bianchi")));
0 commit comments