-
Notifications
You must be signed in to change notification settings - Fork 33
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
DOCSP-49150: bulkWrite docs + api #250
Conversation
✅ Deploy Preview for docs-php-library ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- :ref:`Collection <php-coll-bulk-write>`: You can use the | ||
``MongoDB\Collection::bulkWrite()`` method to perform bulk write | ||
operations on a single collection. This method makes a database call | ||
for each type of write operation. For example, the method can perform | ||
multiple update operations in one call, but makes two separate calls to | ||
the database for an insert operation and a replace operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today I learned that collection bulk write is a driver implementation only to batch individual commands. Confirmed by the spec.
source/reference/method/MongoDBClientBulkWrite-withCollection.txt
Outdated
Show resolved
Hide resolved
source/reference/method/MongoDBClientBulkWrite-createWithCollection.txt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What a massive piece of work, well done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing work!! I mostly suggested small updates but I'll take another look because of the question I left
<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 comment
The 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
<mongodb-driver-exception-bulkwritecommandexception>` is thrown, users should call | |
:php:`getWriteErrors() <mongodb-driver-bulkwritecommandexception.getwriteerrors>` and | |
<mongodb-driver-exception-bulkwritecommandexception>` is thrown, you can call | |
:php:`getWriteErrors() <mongodb-driver-bulkwritecommandexception.getwriteerrors>` and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can change in all extracts, nbd
|
||
.. 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 comment
The reason will be displayed to describe this comment to others. Learn more.
S: to avoid "execute":
This class contains information about an executed client bulk write operation. It | |
This class contains information about a completed client bulk write operation. It |
- | 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 comment
The reason will be displayed to describe this comment to others. Learn more.
s: active voice
- | Returns a boolean indicating whether the bulk operation was | |
acknowledged by the server. | |
- | Returns a boolean indicating whether the server acknowledged the bulk operation. |
|
||
Represents the assembled bulk write command or builder. | ||
:phpmethod:`MongoDB\Client::bulkWrite()` supports | ||
``deleteMany``, ``deleteOne()``, ``insertOne()``, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S:
``deleteMany``, ``deleteOne()``, ``insertOne()``, | |
``deleteMany()``, ``deleteOne()``, ``insertOne()``, |
- If ``true``, allows the write operation to circumvent document level | ||
validation. Defaults to ``false``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: to match the format of the other entries
- If ``true``, allows the write operation to circumvent document level | |
validation. Defaults to ``false``. | |
- If ``true``: Allows the write operation to circumvent document level | |
validation. | |
The default is ``false``. |
source/write/bulk-write.txt
Outdated
To delete multiple documents, call the ``deleteMany()`` method. The specified | ||
operation deletes *all documents* that match the query filter. | ||
|
||
The following example specifies deletion of all matching documents in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S:
The following example specifies deletion of all matching documents in the | |
The following example specifies a deletion of all matching documents in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to the deletion
source/write/bulk-write.txt
Outdated
instance of the ``ClientBulkWrite`` class, then call the ``deleteOne()`` | ||
method. | ||
|
||
The following example specifies deletion of a document in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S:
The following example specifies deletion of a document in the | |
The following example specifies a deletion of a document in the |
source/write/bulk-write.txt
Outdated
operation deletes *all documents* that match the query filter. | ||
|
||
The following example specifies deletion of all matching documents in the | ||
``sample_restaurants.restaurants`` collection: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: might be worth explaining which documents this code is actually matching, since it's not immediately clear from the regex what's going on - like "all documents in the collection that have a name
value containing at least two 'p'
characters"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add descriptions to all of these examples!
source/write/bulk-write.txt
Outdated
performing the remaining writes and throws an exception. | ||
| If set to ``false``: when a single write fails, the operation continues to | ||
attempt the remaining write operations, if any, then throws an exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: to avoid "throws"
performing the remaining writes and throws an exception. | |
| If set to ``false``: when a single write fails, the operation continues to | |
attempt the remaining write operations, if any, then throws an exception. | |
performing the remaining writes and generates an exception. | |
| If set to ``false``: when a single write fails, the operation continues to | |
attempt the remaining write operations, if any, then generates an exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"throw" is a PHP keyword. It has a specific meaning in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to returns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw this - will revert
source/write/bulk-write.txt
Outdated
If the library runs the insert operation first, one document is deleted. | ||
If it runs the delete operation first, no documents are deleted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: which insert and delete operation are you referring to here? do you just mean any insert and delete where the delete operation targets that inserted document?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a copypaste issue - I will remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the note in this section to describe the same situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* DOCSP-44581: v2 release (#234) * DOCSP-44581: v2 release * small fix * Add missing meta descriptions (#235) * Add missing meta descriptions * Apply suggestions from code review --------- Co-authored-by: Rachel Mackintosh <[email protected]> * DOCSP-48761: docker note (#237) * DOCSP-48100: Consolidate minor versions (#240) * DOCSP-48100: Consolidate minor versions * edits * remove old redirects * AB feedback * edit * DOCSP-48718-update-credentials (#247) * update username and password * misspelling * redirects * pre-standardization redirects * upgrade composer package vs * DOCSP-49150: bulkWrite docs + api (#250) * DOCSP-49150: bulkWrite docs + api * first pass fixes * JT PR fixes 1 * upgrade composer package vs * JT PR fixes 2 * small fix * JT PR fixes 3 * remove reference to writeconcern option * add return values sections * object -> instance * NR PR fixes 1 * returns -> throws * DOCSP-50022: remove eol server version mentions (#253) * DOCSP-50022: remove eol server version mentions * consolidate compat table rows * DOCSP-50155 - EOL MongoDB 4.0 (#252) * eol v4.0 * update compat * DOCSP-50294: v2.1 release (#255) --------- Co-authored-by: Nick Larew <[email protected]> Co-authored-by: Rachel Mackintosh <[email protected]> Co-authored-by: Nora Reidy <[email protected]> Co-authored-by: shuangela <[email protected]> Co-authored-by: Mike Woofter <[email protected]>
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-49150
Staging Links
Self-Review Checklist