Skip to content

Commit fa4ff13

Browse files
committed
final feedback
1 parent 08baf89 commit fa4ff13

File tree

1 file changed

+18
-15
lines changed
  • source/fundamentals/crud/write-operations

1 file changed

+18
-15
lines changed

source/fundamentals/crud/write-operations/bulk.txt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ MongoDB Java Driver.
1818

1919
To perform a single create, replace, update, or delete operation, you can use
2020
the 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

2525
You 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
2727
perform 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

321321
Similarly, the ``MongoClient.bulkWrite()`` method takes a
322322
list 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+
328331
These methods take a ``MongoNamespace`` object that defines which
329332
database and collection to write to, and a ``Document`` object that defines
330333
information 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
416419
an error occurs, or until they execute successfully. However, you can pass
417420
``false`` to the ``ordered()`` method on the ``ClientBulkWriteOptions``
418421
interface 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

422425
The following code sets the ``ordered()`` method on an
423426
instance 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

Comments
 (0)