Skip to content

Commit f25264d

Browse files
committed
NR PR fixes 1
1 parent b4005d9 commit f25264d

19 files changed

+116
-83
lines changed

source/includes/extracts-bulkwriteexception.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ref: bulkwriteexception-result
22
content: |
33
If a :php:`MongoDB\Driver\Exception\BulkWriteException
4-
<mongodb-driver-exception-bulkwriteexception>` is thrown, users should call
4+
<mongodb-driver-exception-bulkwriteexception>` is thrown, you can call
55
:php:`getWriteResult() <mongodb-driver-bulkwriteexception.getwriteresult>` and
66
inspect the returned :php:`MongoDB\Driver\WriteResult
77
<mongodb-driver-writeresult>` object to determine the nature of the error.
@@ -14,7 +14,7 @@ content: |
1414
ref: bulkwriteexception-client-result
1515
content: |
1616
If a :php:`MongoDB\Driver\Exception\BulkWriteCommandException
17-
<mongodb-driver-exception-bulkwritecommandexception>` is thrown, users should call
17+
<mongodb-driver-exception-bulkwritecommandexception>` is thrown, you can call
1818
:php:`getWriteErrors() <mongodb-driver-bulkwritecommandexception.getwriteerrors>` and
1919
inspect the information in the returned array to determine the nature of the error.
2020
@@ -25,7 +25,7 @@ content: |
2525
---
2626
ref: bulkwriteexception-ordered
2727
content: |
28-
In the case of a bulk write, the result may indicate multiple successful write
28+
In the case of a bulk write, the result might indicate multiple successful write
2929
operations and/or errors. If the ``ordered`` option is ``true``, some
3030
operations may have succeeded before the first error was encountered and the
3131
exception thrown. If the ``ordered`` option is ``false``, multiple errors may

source/includes/extracts-error.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ ref: error-driver-bulkwriteexception
22
content: |
33
:php:`MongoDB\Driver\Exception\BulkWriteException
44
<mongodb-driver-exception-bulkwriteexception>` for errors related to the write
5-
operation. Users should inspect the value returned by :php:`getWriteResult()
5+
operation. You can inspect the value returned by :php:`getWriteResult()
66
<mongodb-driver-bulkwriteexception.getwriteresult>` to determine the nature of the
77
error.
88
---
99
ref: error-driver-client-bulkwriteexception
1010
content: |
1111
:php:`MongoDB\Driver\Exception\BulkWriteCommandException
1212
<mongodb-driver-exception-bulkwritecommandexception>` for errors related to the write
13-
operation. Users should inspect the value returned by :php:`getWriteErrors()
13+
operation. You can inspect the value returned by :php:`getWriteErrors()
1414
<mongodb-driver-bulkwritecommandexception.getwriteerrors>` to determine the nature of the
1515
error.
1616
---

source/includes/write/bulk-write.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,31 +117,48 @@
117117
// start-bulk-client
118118
$restaurantCollection = $client->sample_restaurants->restaurants;
119119
$movieCollection = $client->sample_mflix->movies;
120-
120+
// Creates the bulk write command and sets the target namespace.
121121
$bulkWrite = MongoDB\ClientBulkWrite::createWithCollection($restaurantCollection);
122+
// Specifies insertion of one document.
122123
$bulkWrite->insertOne(['name' => 'Mongo Deli', 'cuisine' => 'Sandwiches']);
124+
// Specifies a `$set` update to one document with the upsert option
125+
// enabled.
123126
$bulkWrite->updateOne(
124127
['name' => 'Dandelion Bakery'],
125128
['$set' => ['grade' => 'B+']],
126129
['upsert' => true],
127130
);
128-
131+
// Changes the target namespace.
129132
$bulkWrite = $bulkWrite->withCollection($movieCollection);
133+
// Specifies insertion of one document.
130134
$bulkWrite->insertOne(['title' => 'The Green Ray', 'year' => 1986]);
135+
// Specifies deletion of documents in which `title` has two consective
136+
// 'd' characters.
131137
$bulkWrite->deleteMany(
132138
['title' => ['$regex' => 'd{2,}']],
133139
);
140+
// Specifies replacement of one document.
134141
$bulkWrite->replaceOne(
135142
['runtime' => ['$gte' => 200]],
136143
['title' => 'Seven Samurai', 'runtime' => 203],
137144
);
138145

146+
// Performs the bulk write operation.
139147
$result = $client->bulkWrite($bulkWrite);
148+
// Prints a summary of results.
140149
echo 'Inserted documents: ', $result->getInsertedCount(), PHP_EOL;
141150
echo 'Modified documents: ', $result->getModifiedCount(), PHP_EOL;
142151
echo 'Deleted documents: ', $result->getDeletedCount(), PHP_EOL;
143152
// end-bulk-client
144153

145154
// start-bulk-client-options
146-
$bulkWrite = MongoDB\ClientBulkWrite::createWithCollection($collection, ['ordered' => false]);
155+
$bulkWrite = MongoDB\ClientBulkWrite::createWithCollection(
156+
$restaurantCollection,
157+
['ordered' => false]
158+
);
147159
// end-bulk-client-options
160+
161+
// start-bulk-client-unordered-behavior
162+
$bulkWrite->insertOne(['_id' => 4045, 'title' => 'The Green Ray']);
163+
$bulkWrite->deleteOne(['_id' => 4045]);
164+
// end-bulk-client-unordered-behavior

source/reference/class/MongoDBBulkWriteCommandResult.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Definition
77

88
.. phpclass:: MongoDB\BulkWriteCommandResult
99

10-
This class contains information about an executed client bulk write operation. It
10+
This class contains information about a completed client bulk write operation. It
1111
is returned from :phpmethod:`MongoDB\Client::bulkWrite()`.
1212

1313
Methods
@@ -57,8 +57,8 @@ Methods
5757
a document with information corresponding to the operation.
5858

5959
* - ``isAcknowledged()``
60-
- | Returns a boolean indicating whether the bulk operation was
61-
acknowledged by the server.
60+
- | Returns a boolean indicating whether the server acknowledged
61+
the bulk operation.
6262

6363
To learn more about the information returned from the server when you
6464
perform a client bulk write operation, see the :manual:`Output

source/reference/class/MongoDBBulkWriteResult.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Definition
77

88
.. phpclass:: MongoDB\BulkWriteResult
99

10-
This class contains information about an executed bulk write operation. It
10+
This class contains information about a completed bulk write operation. It
1111
encapsulates a :php:`MongoDB\Driver\WriteResult <class.mongodb-driver-writeresult>`
1212
object and is returned from :phpmethod:`MongoDB\Collection::bulkWrite()`.
1313

@@ -33,4 +33,4 @@ Methods
3333
- :phpmethod:`MongoDB\BulkWriteResult::getModifiedCount()`
3434
- :phpmethod:`MongoDB\BulkWriteResult::getUpsertedCount()`
3535
- :phpmethod:`MongoDB\BulkWriteResult::getUpsertedIds()`
36-
- :phpmethod:`MongoDB\BulkWriteResult::isAcknowledged()`
36+
- :phpmethod:`MongoDB\BulkWriteResult::isAcknowledged()`

source/reference/method/MongoDBClient-bulkWrite.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Parameters
4343

4444
Represents the assembled bulk write command or builder.
4545
:phpmethod:`MongoDB\Client::bulkWrite()` supports
46-
``deleteMany``, ``deleteOne()``, ``insertOne()``,
46+
``deleteMany()``, ``deleteOne()``, ``insertOne()``,
4747
``replaceOne()``, ``updateMany()``, and ``updateOne()``
4848
operations.
4949

source/reference/method/MongoDBClientBulkWrite-createWithCollection.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ Parameters
4848

4949
* - bypassDocumentValidation
5050
- boolean
51-
- If ``true``, allows the write operation to circumvent document level
52-
validation. Defaults to ``false``.
51+
- If ``true``: the write operation ignores document level
52+
validation.
53+
54+
The default is ``false``.
5355

5456
* - comment
5557
- mixed
@@ -61,17 +63,19 @@ Parameters
6163

6264
* - ordered
6365
- boolean
64-
- If ``true``: when a single write fails, the operation stops without
65-
performing the remaining writes and throws an exception.
66+
- If ``true``: When a single write fails, the operation stops without
67+
performing the remaining writes and returns an exception.
6668

67-
If ``false``: when a single write fails, the operation continues
68-
with the remaining writes, if any, and throws an exception.
69+
If ``false``: When a single write fails, the operation continues
70+
with the remaining writes, if any, and returns an exception.
6971

7072
The default is ``true``.
7173

7274
* - verboseResults
7375
- boolean
74-
- Specifies whether to return verbose results. The default is ``false``.
76+
- Specifies whether to return verbose results.
77+
78+
The default is ``false``.
7579

7680
Return Values
7781
-------------

source/reference/method/MongoDBClientBulkWrite-deleteMany.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Definition
1717

1818
Specify a delete operation in the bulk write command for all
1919
matching documents. This method returns the
20-
:phpclass:`MongoDB\ClientBulkWrite` instance on which its called.
20+
:phpclass:`MongoDB\ClientBulkWrite` instance on which it's called.
2121

2222
.. code-block:: php
2323

source/reference/method/MongoDBClientBulkWrite-deleteOne.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Definition
1717

1818
Specify a delete operation in the bulk write command for the first
1919
matching document. This method returns the
20-
:phpclass:`MongoDB\ClientBulkWrite` instance on which its called.
20+
:phpclass:`MongoDB\ClientBulkWrite` instance on which it's called.
2121

2222
.. code-block:: php
2323

source/reference/method/MongoDBClientBulkWrite-insertOne.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Definition
1616
.. phpmethod:: MongoDB\ClientBulkWrite::insertOne()
1717

1818
Specify an insert operation in the bulk write command. This method
19-
returns the :phpclass:`MongoDB\ClientBulkWrite` instance on which its called.
19+
returns the :phpclass:`MongoDB\ClientBulkWrite` instance on which it's called.
2020

2121
.. code-block:: php
2222

source/reference/method/MongoDBClientBulkWrite-replaceOne.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Definition
1717

1818
Specify a replace operation in the bulk write command for the first
1919
matching document. This method returns the
20-
:phpclass:`MongoDB\ClientBulkWrite` instance on which its called.
20+
:phpclass:`MongoDB\ClientBulkWrite` instance on which it's called.
2121

2222
.. code-block:: php
2323

source/reference/method/MongoDBClientBulkWrite-updateMany.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Definition
1717

1818
Specify an update operation in the bulk write command for all
1919
matching documents. This method returns the
20-
:phpclass:`MongoDB\ClientBulkWrite` instance on which its called.
20+
:phpclass:`MongoDB\ClientBulkWrite` instance on which it's called.
2121

2222
.. code-block:: php
2323

@@ -34,7 +34,7 @@ Parameters
3434
The filter criteria that specifies the documents to update.
3535

3636
``$update`` : array|object
37-
Specifies the field and value combinations to update and any relevant update
37+
The field and value combinations to update and any relevant update
3838
operators. ``$update`` uses MongoDB's :manual:`update operators </reference/operator/update>`.
3939
You can pass an :manual:`aggregation pipeline
4040
</reference/command/update/#update-with-an-aggregation-pipeline>` as this parameter.

source/reference/method/MongoDBClientBulkWrite-updateOne.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Definition
1717

1818
Specify an update operation in the bulk write command for the first
1919
matching document. This method returns the
20-
:phpclass:`MongoDB\ClientBulkWrite` instance on which its called.
20+
:phpclass:`MongoDB\ClientBulkWrite` instance on which it's called.
2121

2222
.. code-block:: php
2323

@@ -34,7 +34,7 @@ Parameters
3434
The filter criteria that specifies the documents to update.
3535

3636
``$update`` : array|object
37-
Specifies the field and value combinations to update and any relevant update
37+
The field and value combinations to update and any relevant update
3838
operators. ``$update`` uses MongoDB's :manual:`update operators
3939
</reference/operator/update>`. You can pass an :manual:`aggregation pipeline
4040
</reference/command/update/#update-with-an-aggregation-pipeline>` as

source/reference/method/MongoDBClientBulkWrite-withCollection.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ Definition
1818
Return an updated instance of :phpclass:`MongoDB\ClientBulkWrite`
1919
from the provided :phpclass:`MongoDB\Collection` instance. This
2020
method allows you to add subsequent write operations on a different
21-
collection than that with which the ``ClientBulkWrite`` was created
22-
with.
21+
collection than that with which the ``ClientBulkWrite`` was created.
2322

2423
This method does not build a new :php:`BulkWriteCommand
2524
<mongodb-driver-bulkwritecommand>` and does not edit the

source/reference/method/MongoDBCollection-bulkWrite.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ Parameters
104104

105105
* - ordered
106106
- boolean
107-
- If ``true``: when a single write fails, the operation will stop without
107+
- If ``true``: When a single write fails, the operation will stop without
108108
performing the remaining writes and throw an exception.
109109

110-
If ``false``: when a single write fails, the operation will continue
110+
If ``false``: When a single write fails, the operation will continue
111111
with the remaining writes, if any, and throw an exception.
112112

113113
The default is ``true``.

source/reference/method/MongoDBCollection-insertMany.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ Parameters
6464

6565
* - ordered
6666
- boolean
67-
- If ``true``: when a single write fails, the operation will stop without
67+
- If ``true``: When a single write fails, the operation will stop without
6868
performing the remaining writes and throw an exception.
6969

70-
If ``false``: when a single write fails, the operation will continue
70+
If ``false``: When a single write fails, the operation will continue
7171
with the remaining writes, if any, and throw an exception.
7272

7373
The default is ``true``.

0 commit comments

Comments
 (0)