-
Notifications
You must be signed in to change notification settings - Fork 34
DOCSP-49150: bulkWrite docs + api #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
063a59b
e634bc8
6a2ab7a
5cbb508
d14ca58
a29dfde
6d3217e
5b07d53
5ae84b8
1b2d7e0
b4005d9
f25264d
7166329
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ ref: bulkwriteexception-result | |||||||||
content: | | ||||||||||
If a :php:`MongoDB\Driver\Exception\BulkWriteException | ||||||||||
<mongodb-driver-exception-bulkwriteexception>` is thrown, users should call | ||||||||||
:php:`getWriteResult() <mongodb-driver-writeexception.getwriteresult>` and | ||||||||||
:php:`getWriteResult() <mongodb-driver-bulkwriteexception.getwriteresult>` and | ||||||||||
inspect the returned :php:`MongoDB\Driver\WriteResult | ||||||||||
<mongodb-driver-writeresult>` object to determine the nature of the error. | ||||||||||
|
||||||||||
|
@@ -11,11 +11,22 @@ content: | | |||||||||
too long). Alternatively, a write operation may have failed outright (e.g. | ||||||||||
unique key violation). | ||||||||||
--- | ||||||||||
ref: bulkwriteexception-client-result | ||||||||||
content: | | ||||||||||
If a :php:`MongoDB\Driver\Exception\BulkWriteCommandException | ||||||||||
<mongodb-driver-exception-bulkwritecommandexception>` is thrown, users should call | ||||||||||
:php:`getWriteErrors() <mongodb-driver-bulkwritecommandexception.getwriteerrors>` and | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. S: second person / present tense; although it seems like a lot of these use "users" so that change is not necessary
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can change in all extracts, nbd |
||||||||||
inspect the information in the returned array to determine the nature of the error. | ||||||||||
|
||||||||||
For example, a write operation may have been successfully applied to the | ||||||||||
primary server but failed to satisfy the write concern. Alternatively, a | ||||||||||
write operation may have failed outright, for example for violating the | ||||||||||
unique key constraint. | ||||||||||
--- | ||||||||||
ref: bulkwriteexception-ordered | ||||||||||
content: | | ||||||||||
In the case of a bulk write, the result may indicate multiple successful write | ||||||||||
operations and/or errors. If the ``ordered`` option is ``true``, some | ||||||||||
operations may have succeeded before the first error was encountered and the | ||||||||||
exception thrown. If the ``ordered`` option is ``false``, multiple errors may | ||||||||||
have been encountered. | ||||||||||
... |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,71 @@ | ||||||||
===================================== | ||||||||
MongoDB\\BulkWriteCommandResult Class | ||||||||
===================================== | ||||||||
|
||||||||
Definition | ||||||||
---------- | ||||||||
|
||||||||
.. phpclass:: MongoDB\BulkWriteCommandResult | ||||||||
|
||||||||
This class contains information about an executed client bulk write operation. It | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. S: to avoid "execute":
Suggested change
|
||||||||
is returned from :phpmethod:`MongoDB\Client::bulkWrite()`. | ||||||||
|
||||||||
Methods | ||||||||
------- | ||||||||
|
||||||||
.. list-table:: | ||||||||
:widths: 30 70 | ||||||||
:header-rows: 1 | ||||||||
|
||||||||
* - Method | ||||||||
- Description | ||||||||
|
||||||||
* - ``getInsertedCount()`` | ||||||||
- | Returns the total number of documents inserted by all | ||||||||
insert operations in the bulk write command. | ||||||||
|
||||||||
* - ``getMatchedCount()`` | ||||||||
- | Returns the total number of documents matched by all | ||||||||
update and replace operations in the bulk write command. | ||||||||
|
||||||||
* - ``getModifiedCount()`` | ||||||||
- | Returns the total number of documents modified by all update | ||||||||
and replace operations in the bulk write command. | ||||||||
|
||||||||
* - ``getUpsertedCount()`` | ||||||||
- | Returns the total number of documents upserted by all update | ||||||||
and replace operations in the bulk write command. | ||||||||
|
||||||||
* - ``getDeletedCount()`` | ||||||||
- | Return the total number of documents deleted by all delete | ||||||||
operations in the bulk write command. | ||||||||
|
||||||||
* - ``getInsertResults()`` | ||||||||
- | Returns a map of results of each successful insert operation. Each | ||||||||
operation is represented by an integer key, which contains a | ||||||||
document with information corresponding to the operation such | ||||||||
as the inserted ``_id`` value. | ||||||||
|
||||||||
* - ``getUpdateResults()`` | ||||||||
- | Returns a map of results of each successful update operation. Each | ||||||||
operation is represented by an integer key, which contains a | ||||||||
document with information corresponding to the operation. | ||||||||
|
||||||||
* - ``getDeleteResults()`` | ||||||||
- | Returns a map of results of each successful delete operation. | ||||||||
Each operation is represented by an integer key, which contains | ||||||||
a document with information corresponding to the operation. | ||||||||
|
||||||||
* - ``isAcknowledged()`` | ||||||||
- | Returns a boolean indicating whether the bulk operation was | ||||||||
acknowledged by the server. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s: active voice
Suggested change
|
||||||||
|
||||||||
To learn more about the information returned from the server when you | ||||||||
perform a client bulk write operation, see the :manual:`Output | ||||||||
</reference/method/Mongo.bulkWrite/#output>` section of the | ||||||||
``Mongo.bulkWrite`` shell method reference. | ||||||||
|
||||||||
See Also | ||||||||
-------- | ||||||||
|
||||||||
- :ref:`php-client-bulk-write` section of the Bulk Write Operations guide |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
============================== | ||
MongoDB\\ClientBulkWrite Class | ||
============================== | ||
|
||
.. versionadded:: 2.1 | ||
|
||
Definition | ||
---------- | ||
|
||
.. phpclass:: MongoDB\ClientBulkWrite | ||
|
||
This class enables you to assemble a bulk write command that you | ||
pass to :phpmethod:`MongoDB\Client::bulkWrite()` to perform write | ||
operations across multiple namespaces. | ||
|
||
``ClientBulkWrite`` is a builder class to create a :php:`BulkWriteCommand | ||
<mongodb-driver-bulkwritecommand>` instance that the library sends to the | ||
server. | ||
|
||
Specify the ``writeConcern`` option as a top-level option to | ||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||
:phpmethod:`MongoDB\Client::bulkWrite()` instead of in each | ||
individual operation on this class. | ||
|
||
Methods | ||
------- | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
createWithCollection() </reference/method/MongoDBClientBulkWrite-createWithCollection> | ||
deleteMany() </reference/method/MongoDBClientBulkWrite-deleteMany> | ||
deleteOne() </reference/method/MongoDBClientBulkWrite-deleteOne> | ||
insertOne() </reference/method/MongoDBClientBulkWrite-insertOne> | ||
replaceOne() </reference/method/MongoDBClientBulkWrite-replaceOne> | ||
updateMany() </reference/method/MongoDBClientBulkWrite-updateMany> | ||
updateOne() </reference/method/MongoDBClientBulkWrite-updateOne> | ||
withCollection() </reference/method/MongoDBClientBulkWrite-withCollection> | ||
|
||
- :phpmethod:`MongoDB\ClientBulkWrite::createWithCollection()` | ||
- :phpmethod:`MongoDB\ClientBulkWrite::deleteMany()` | ||
- :phpmethod:`MongoDB\ClientBulkWrite::deleteOne()` | ||
- :phpmethod:`MongoDB\ClientBulkWrite::insertOne()` | ||
- :phpmethod:`MongoDB\ClientBulkWrite::replaceOne()` | ||
- :phpmethod:`MongoDB\ClientBulkWrite::updateMany()` | ||
- :phpmethod:`MongoDB\ClientBulkWrite::updateOne()` | ||
- :phpmethod:`MongoDB\ClientBulkWrite::withCollection()` | ||
|
||
See Also | ||
-------- | ||
|
||
- :ref:`php-client-bulk-write` section of the Bulk Write Operations guide |
Uh oh!
There was an error while loading. Please reload this page.