-
Notifications
You must be signed in to change notification settings - Fork 33
DOCSP-46818: Client bulk write #474
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-46818: Client bulk write #474
Conversation
✅ Deploy Preview for docs-golang ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
As I was reviewing I noticed that you have organized this page into functions instead of APIs. Personally, I found it more difficult to move through sections, then find my specific API of interest as opposed to organizing them into two separate sections as we do here . Happy to talk more about how to best organize the page but I think it is confusing to stack the collection/client info in each section
multiple namespaces. In MongoDB, a namespace consists of the database name and the collection | ||
name in the format ``<database>.<collection>``. | ||
|
||
.. important:: |
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: add a title
"Client Bulk Write Compatibility"
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.
A few things but great work fixing up this page!
method. When calling ``BulkWrite()`` on a ``Collection`` instance, you can | ||
perform multiple write operations on a single collection. When calling | ||
``BulkWrite()`` on a ``Client`` instance, you can perform bulk writes across | ||
multiple namespaces. In MongoDB, a namespace consists of the database name and the collection | ||
name in the format ``<database>.<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: in the bulk write method the namespaces are not given in that format so I recommend removing to avoid confusion
method. When calling ``BulkWrite()`` on a ``Collection`` instance, you can | |
perform multiple write operations on a single collection. When calling | |
``BulkWrite()`` on a ``Client`` instance, you can perform bulk writes across | |
multiple namespaces. In MongoDB, a namespace consists of the database name and the collection | |
name in the format ``<database>.<collection>``. | |
method. You can use the ``Collection.BulkWrite()`` method to | |
perform multiple write operations on a single collection. When calling | |
the ``Collection.BulkWrite()`` method, you can perform bulk writes across | |
multiple namespaces. In MongoDB, a namespace consists of a database name and a collection name. |
ensure that your application meets the following | ||
requirements: | ||
|
||
- Uses {+driver-short+} v2.1 or later |
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: remove this first pooint and combine into a sentence. This change will only be on the v2.1+ branch anyways so no need to explicitly include
type, which represents options you can use to modify its behavior. If | ||
you don't specify a ``BulkWriteOptions``, the driver uses the default | ||
values for each option. | ||
Modify Collection-Level Behavior |
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 suggest moving the options and return value sections to the end of this section after the define write models section (applies to collection and client)
@@ -226,33 +248,36 @@ their behavior with the following methods: | |||
* - ``SetHint()`` | |||
- | The index to use to scan for documents. | |||
|
|||
* - ``SetSort()`` | |||
- | The criteria to use when ordering matching documents. | |||
This method is not available for the ``UpdateMnyModel`` |
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 method is not available for the ``UpdateMnyModel`` | |
This method is only available for the ``UpdateOneModel`` |
|
||
To specify the write operations for your bulk operation on multiple | ||
namespaces, create a ``ClientWriteModel`` for each insert, | ||
replace, update, or delete. |
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: add a sentence describing how the first two parameters for each model supply the target namespace
:dedent: | ||
:start-after: begin bulk update model client | ||
:end-before: end bulk update model client | ||
|
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: add a note that describes updatemany model as an option to update all matching documents
@@ -390,13 +734,21 @@ API Documentation | |||
To learn more about any of the methods or types discussed in this | |||
guide, see the following API Documentation: | |||
|
|||
- `BulkWrite() <{+api+}/mongo#Collection.BulkWrite>`__ |
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: consider sorting this into two lists as done on the kotlin sync page
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.
great work! just left a comment about a bug but lgtm
source/whats-new.txt
Outdated
<<<<<<< HEAD | ||
* :ref:`Version 2.1 <golang-version-2.0>` | ||
======= | ||
* :ref:`Version 2.1 <golang-version-2.1>` | ||
>>>>>>> upstream/master |
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: I believe there's a merge error still in the PR
To modify the behavior of your bulk write operation, pass a ``BulkWriteOptions`` | ||
instance to the ``BulkWrite()`` method. | ||
|
||
The ``BulkWriteOptions`` type allows you to configure options by using 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.
Do we need to add SetComment()
and SetLet()
?
``BulkWriteResult`` type contains the following properties: | ||
includes information about the bulk operation. | ||
|
||
The ``BulkWriteResult`` type contains the following properties: |
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.
Do we need to add the Acknowledged
property?
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.
added!
@@ -15,54 +15,243 @@ Bulk Operations | |||
Overview | |||
-------- | |||
|
|||
In this guide, you can learn how to use **bulk operations**. | |||
In this guide, you can learn how to use {+driver-short+} to |
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.
In this guide, you can learn how to use {+driver-short+} to | |
In this guide, you can learn how to use {+driver-long+} to |
Probably best to use the full name (MongoDB Go Driver) since this is the first occurrence
- | Specifies a document with a list of values to improve operation readability. Values | ||
must be constant or closed expressions that don't reference document fields. For more | ||
information, see the :manual:`let statement | ||
</reference/command/delete/#std-label-delete-let-syntax>` in the {+mdb-server+} manual. |
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.
Do we need to mention the </reference/command/update/#std-label-update-let-syntax> as well?
Also, do we need to somehow align this section with the SetLet
in the "Client-Level Behavior" underneath?
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.
Since the description of the let statement is the same on the delete and update page, I don't think we need to link to both. I can remove the link if you think that's confusing. And yes I'll make sure the two definitions align, thanks for catching that.
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.
👍 IMO, a link to a generic reference is not necessary for the Golang-specific doc, neither the delete nor the update. Moreover, listing the delete syntax alone causes a feeling like it's for the delete operation only. However, I'm OK with either keeping the "delete-let-syntax" link or removing it. @jtazin, what are your thoughts?
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.
Yeah, I agree that it could be confusing to link to one and not the other. It sounds like it would be best to either have both or none.
I do like having links for more information, especially since "let" doesn't seem obvious to me.
The Server bulk write documentation includes both. To bad there isn't a way to link directly to the "let" on this page. Perhaps we can copy what we do?
Either way, I don't feel too strongly about this one.
@norareidy and @qingyang-hu let me know if you have additional thoughts.
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.
Okay, I added links to both the delete and update pages.
* DOCSP-46818: Client bulk write * rest of page * edits * RR feedback * edit * fix * edits * RR feedback 2 * edits * whats new * link * wording * fix merge error * tech review * QH feedback 2 * let links (cherry picked from commit e8c6de2)
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-46818
Staging - https://deploy-preview-474--docs-golang.netlify.app/fundamentals/crud/write-operations/bulk/
Self-Review Checklist