Skip to content

Commit fc13f79

Browse files
committed
coordinate updates to BW content
(cherry picked from commit aa0fbd4)
1 parent a122579 commit fc13f79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+95
-75
lines changed

source/fundamentals/auth.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Authentication Mechanisms
55
=========================
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/builders/filters.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Filters Builders
33
================
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

source/fundamentals/builders/indexes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Indexes Builders
33
================
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

source/fundamentals/builders/projections.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Projections Builders
33
====================
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

source/fundamentals/collations.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Collations
33
==========
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

source/fundamentals/crud.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
CRUD Operations
55
===============
66

7-
.. default-domain:: mongodb
7+
88

99
.. toctree::
1010
:caption: CRUD Operations

source/fundamentals/crud/compound-operations.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Compound Operations
33
===================
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

source/fundamentals/crud/query-document.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Specify a Query
33
===============
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

source/fundamentals/crud/read-operations/change-streams.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Open Change Streams
66
===================
77

8-
.. default-domain:: mongodb
8+
99

1010
.. contents:: On this page
1111
:local:

source/fundamentals/crud/read-operations/cursor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Access Data From a Cursor
55
=========================
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/crud/read-operations/geo.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Search Geospatially
33
===================
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

source/fundamentals/crud/read-operations/limit.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Limit the Number of Returned Results
55
====================================
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/crud/read-operations/project.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Specify Which Fields to Return
55
==============================
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/crud/read-operations/retrieve.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Retrieve Data
55
==============
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/crud/read-operations/skip.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Skip Returned Results
55
=====================
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/crud/read-operations/sort.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Sort Results
55
============
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/crud/read-operations/text.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Search Text
55
===========
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

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

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,24 @@ Bulk Operations
1010
:depth: 2
1111
:class: singlecol
1212

13+
.. facet::
14+
:name: genre
15+
:values: reference
16+
1317
.. meta::
18+
:description: Learn how to perform bulk operations by using the MongoDB Java Sync Driver
1419
:keywords: insert, update, replace, code example, efficiency
1520

1621
Overview
1722
--------
1823

1924
In this guide, you can learn how to use bulk operations in the
20-
MongoDB Java Driver.
25+
{+driver-short+}.
2126

2227
To perform a single create, replace, update, or delete operation, you can use
2328
the corresponding method. For example, to insert one document and replace one
2429
document, you can use the ``insertOne()`` and ``replaceOne()`` methods. When you
25-
use these methods, the ``MongoClient`` makes one call to the database for each operation.
30+
use these methods, your client makes one call to the database for each operation.
2631

2732
By using a bulk write operation, you can perform multiple write operations in
2833
fewer database calls. You can perform bulk write operations at the following levels:
@@ -277,14 +282,14 @@ second parameter to specify whether the execution of the bulk operations is
277282
ordered or unordered.
278283

279284
Ordered Execution
280-
+++++++++++++++++
285+
`````````````````
281286

282287
By default, the ``bulkWrite()`` method executes bulk operations in
283288
order. This means that the bulk operations execute in the order you
284289
added them to the list until an error occurs, if any.
285290

286291
Example
287-
```````
292+
^^^^^^^
288293

289294
The following example performs these bulk operations:
290295

@@ -313,7 +318,7 @@ document:
313318
{ "_id": 6, "name": "Zaynab Hassan", "age": 37 }
314319

315320
Unordered Execution
316-
+++++++++++++++++++
321+
```````````````````
317322

318323
You can also execute bulk operations in any order by specifying "false"
319324
to the ``order()`` method on ``BulkWriteOptions``. This means that
@@ -370,6 +375,14 @@ instance methods. For example, an instance of ``ClientNamespacedInsertOneModel``
370375
operation to insert one document, and you can create this model by using
371376
the ``ClientNamespacedWriteModel.insertOne()`` method.
372377

378+
.. note:: Bulk Write Errors
379+
380+
If any of the write operations fail, the driver raises a
381+
``ClientBulkWriteException`` and does not perform any further individual
382+
operations. ``ClientBulkWriteException`` includes a ``BulkWriteError`` that can
383+
be accessed by using the ``ClientBulkWriteException.getWriteErrors()``
384+
method, which provides details of the individual failure.
385+
373386
The models and their corresponding instance methods are described
374387
in the table below.
375388

@@ -400,7 +413,7 @@ in the table below.
400413

401414
``updatePipeline``: Update pipeline to apply to matching document
402415

403-
``options``: (optional) Options to apply when updating document
416+
``options``: *(optional)* Options to apply when updating document
404417

405418
You must pass a value for either the ``update`` or ``updatePipeline``
406419
parameter.
@@ -417,7 +430,7 @@ in the table below.
417430

418431
``updatePipeline``: Update pipeline to apply to matching documents
419432

420-
``options``: (optional) Options to apply when updating documents
433+
``options``: *(optional)* Options to apply when updating documents
421434

422435
You must pass a value for either the ``update`` or ``updatePipeline``
423436
parameter.
@@ -432,7 +445,7 @@ in the table below.
432445

433446
``replacement``: Replacement document
434447

435-
``options``: (optional) Options to apply when replacing documents
448+
``options``: *(optional)* Options to apply when replacing documents
436449

437450
* - ``ClientNamespacedDeleteOneModel``
438451
- ``deleteOne()``
@@ -442,7 +455,7 @@ in the table below.
442455

443456
``filter``: Filter that selects which document to delete
444457

445-
``option``: (optional) Options to apply when deleting document
458+
``option``: *(optional)* Options to apply when deleting document
446459

447460
* - ``ClientNamespacedDeleteManyModel``
448461
- ``deleteMany()``
@@ -452,11 +465,20 @@ in the table below.
452465

453466
``filter``: Filter that selects which documents to delete
454467

455-
``option``: (optional) Options to apply when deleting documents
468+
``option``: *(optional)* Options to apply when deleting documents
456469

457470
The following sections provide examples of how to use the client ``bulkWrite()``
458471
method.
459472

473+
To learn more about the methods and classes mentioned in this section,
474+
see the following API documentation:
475+
476+
- `bulkWrite()
477+
<{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCluster.html#bulkWrite(java.util.List,com.mongodb.client.model.bulk.ClientBulkWriteOptions)>`__
478+
- `ClientNamespacedWriteModel
479+
<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/bulk/ClientNamespacedWriteModel.html>`__
480+
- `MongoNamespace <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoNamespace.html>`__
481+
460482
Insert Example
461483
~~~~~~~~~~~~~~
462484

@@ -473,25 +495,22 @@ each write operation applies to.
473495

474496
List<ClientNamespacedWriteModel> bulkOperations = new ArrayList<>();
475497

476-
ClientNamespacedInsertOneModel insertDocument1 = new ClientNamespacedWriteModel
498+
bulkOperations.add(ClientNamespacedWriteModel
477499
.insertOne(
478500
peopleNamespace,
479501
new Document("name", "Julia Smith")
480-
);
502+
)
503+
);
481504

482-
ClientNamespacedInsertOneModel insertDocument2 = new ClientNamespacedWriteModel
505+
bulkOperations.add(ClientNamespacedWriteModel
483506
.insertOne(
484507
thingsNamespace,
485508
new Document("object", "washing machine")
486-
);
487-
488-
bulkOperations.add(insertDocument1);
489-
bulkOperations.add(insertDocument2);
509+
)
510+
);
490511

491512
ClientBulkWriteResult result = mongoClient.bulkWrite(bulkOperations);
492513

493-
.. TODO: link documentation
494-
495514
Replace Example
496515
~~~~~~~~~~~~~~~
497516

@@ -553,7 +572,9 @@ insert multiple documents.
553572

554573
MongoNamespace namespace = new MongoNamespace("db", "people");
555574

556-
ClientBulkWriteOptions options = new ClientBulkWriteOptions().ordered(false);
575+
ClientBulkWriteOptions options = ClientBulkWriteOptions
576+
.clientBulkWriteOptions()
577+
.ordered(false);
557578

558579
List<ClientNamespacedWriteModel> bulkOperations = new ArrayList<>();
559580

@@ -585,7 +606,11 @@ Even though the write operation inserting a document with a duplicate key result
585606
in an error, the other operations are executed because the write operation is
586607
unordered.
587608

588-
.. TODO: link documentation
609+
To learn more about the methods and classes mentioned in this section,
610+
see the following API documentation:
611+
612+
- `ClientBulkWriteOptions <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/bulk/ClientBulkWriteOptions.html>`__
613+
- `ClientBulkWriteResult <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/bulk/ClientBulkWriteResult.html>`__
589614

590615
Summary
591616
-------
@@ -606,6 +631,10 @@ There are two ways to execute the ``bulkWrite()`` method:
606631
- Unordered, which performs all the bulk operations in any order and reports errors
607632
at the end, if any
608633

634+
To learn more about the collection ``bulkWrite`` command, see the
635+
:manual:`db.collection.bulkWrite() </reference/method/db.collection.bulkWrite/>`
636+
method reference in the {+mdb-server+} Manual.
637+
609638
``MongoClient.bulkWrite()``
610639
~~~~~~~~~~~~~~~~~~~~~~~~~~~
611640

@@ -627,7 +656,5 @@ The ``MongoClient.bulkWrite()`` method can also take a ``ClientBulkWriteOptions`
627656
object to specify different options for how the command is executed.
628657

629658
To learn more about the client ``bulkWrite`` command, see the
630-
:manual:`bulkWrite() <reference/command/bulkWrite/>` method reference in the {+mdb-server+}
659+
:manual:`bulkWrite() </reference/command/bulkWrite/>` method reference in the {+mdb-server+}
631660
Manual.
632-
633-
.. TODO: Add API Documentation

source/fundamentals/crud/write-operations/embedded-arrays.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Update Arrays in a Document
55
===========================
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Insert Operations
55
=================
66

7-
.. default-domain:: mongodb
8-
97
.. contents:: On this page
108
:local:
119
:backlinks: none

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Insert or Update in a Single Operation
33
======================================
44

5-
.. default-domain:: mongodb
6-
75
.. contents:: On this page
86
:local:
97
:backlinks: none

source/fundamentals/data-formats/codecs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Codecs
55
======
66

7-
.. default-domain:: mongodb
7+
88

99
.. contents:: On this page
1010
:local:

source/fundamentals/data-formats/document-data-format-bson.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Document Data Format: BSON
33
==========================
44

5-
.. default-domain:: mongodb
5+
66

77
.. contents:: On this page
88
:local:

0 commit comments

Comments
 (0)