-
Notifications
You must be signed in to change notification settings - Fork 81
DOCSP-34569 Bulk Update Task Page #580
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 all commits
be8fdb5
0a6b621
11d662f
954e75b
6fb0c0b
42c3187
0901486
985017b
62977fd
21272fe
845d8c2
c4393df
a1a3a26
c561439
31d516d
1bfe275
1232f31
068ab61
c12bda0
971d5e8
8cad6a2
41a0083
538a0a5
ef870dd
e1b9ba5
ecec615
10e4155
c641443
f452a60
2fd9fdf
e47f563
604086f
7b86709
7f03dfe
cae8620
e7e7299
78386e6
1c8e23d
b5e6987
1927a90
095acf5
6ea9f20
bcf28d9
481beba
b8f82d3
68412f0
9357e1e
4b7f0db
a93a4d3
33e09d9
be9e119
9cd767a
7f15431
e617a8b
ec0f84d
5ee99e1
93072e5
981f7b5
5480bd0
ff22e41
812c952
8a17df1
faa46d0
8871958
4d6c4ed
10025ce
561e7cf
0adb56a
9eec497
6510faa
28d40ae
9f22150
c1db844
3753387
a50ea59
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 |
---|---|---|
|
@@ -14,4 +14,155 @@ Modify Multiple Documents | |
:depth: 1 | ||
:class: singlecol | ||
|
||
You can perform bulk update operations on multiple documents in Compass. | ||
You can perform bulk update operations on multiple documents in Compass | ||
by using the :guilabel:`Update Documents` modal. Performing updates with | ||
the :guilabel:`Update Documents` modal helps you visualize updates | ||
to your data before you apply them. | ||
|
||
About this Task | ||
--------------- | ||
|
||
- You can use any syntax that works with the ``update`` parameter of | ||
:method:`db.collection.updateMany()`. | ||
|
||
- The :guilabel:`Update Documents` modal does not support any ``options`` | ||
parameters such as upsert, writeConcern, or collation. | ||
|
||
Before you Begin | ||
---------------- | ||
|
||
The :guilabel:`Update Documents` modal is available starting | ||
in Compass version ``1.5.X``. For instructions on updating or installing | ||
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. Version is not yet confirmed, will update this when the exact release version is known. |
||
the latest Compass version, see :ref:`download-install`. | ||
|
||
Steps | ||
----- | ||
|
||
.. procedure:: | ||
:style: normal | ||
|
||
.. step:: Apply a query filter | ||
|
||
From the :guilabel:`Documents` tab, input a query into the | ||
:guilabel:`Query bar`. The filter criteria of the query specified | ||
applies to the documents in the :guilabel:`Bulk Update` modal. If | ||
you need to apply an update to all documents in a collection, | ||
leave the :guilabel:`Query bar` blank. | ||
|
||
.. step:: Open the bulk update modal | ||
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. Even though this is listed in the table, I think it would make sense for the first step to be to filter the documents you want to update in the query bar. Chronologically, this has to happen first. We can say something like "if you would like to update all of the documents in the collection, skip this step and proceed to step 2." |
||
|
||
On the :guilabel:`Documents` tab, click the :icon-lg:`Edit` | ||
:guilabel:`Update` button to display the | ||
:guilabel:`Update Documents` modal. The following | ||
table summarizes the :abbr:`UI (User Interface)` of the modal: | ||
|
||
.. list-table:: | ||
:widths: 40 60 | ||
:header-rows: 1 | ||
|
||
* - UI Element | ||
- Description | ||
|
||
* - :guilabel:`Filter` | ||
- Any filter criteria specified on the | ||
:guilabel:`Query Bar` applies to the | ||
:guilabel:`Update Documents` modal. | ||
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 we add something along the lines of "You must return to the query bar to edit this field" or "you must exit the update modal to edit this field" |
||
To update the filter query, exit the | ||
:guilabel:`Update Documents` modal and modify the | ||
query in the :guilabel:`Query Bar`. | ||
* - :guilabel:`Update` | ||
- The update syntax that is applied to the | ||
documents specified in the filter criteria. You can use | ||
any syntax that works with the ``update`` parameter of the | ||
:method:`db.collection.updateMany()`. | ||
* - :guilabel:`Preview` | ||
- A preview of documents with the update syntax applied. | ||
|
||
.. step:: Enter the update syntax | ||
|
||
In the :guilabel:`Update` text field, provide the update | ||
syntax. | ||
|
||
The number of documents affected by the update displays at | ||
the top of the :guilabel:`Update Documents` modal. | ||
|
||
.. note:: | ||
|
||
The documents under the :guilabel:`Preview` header show how the | ||
:guilabel:`Update` syntax affects documents in your collection. | ||
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. "syntax" makes sense above, because you are talking about the actual syntax that a user has to write. here (and below) it feels a little weird. We could say "Update command" or simply just the bolded "Update" (I may prefer the latter) |
||
|
||
.. step:: (Optional) Name and save your :guilabel:`Update` | ||
|
||
You can name and save the update query in the | ||
:guilabel:`Update Documents` modal. Saving your query adds it | ||
to your :ref:`favorite queries <saved-favorite-query-view>` for | ||
that collection and allows you to load and copy the query after | ||
you close the modal. | ||
|
||
a. Click the :guilabel:`Save` button on the bottom left of the | ||
modal. | ||
#. Enter a name for the update syntax. | ||
#. Click the green :guilabel:`Save` button. | ||
|
||
.. step:: Update your documents | ||
|
||
Click :guilabel:`Update Documents`. | ||
|
||
Compass applies the :guilabel:`Update` to the documents | ||
within the :guilabel:`Filter` expression. | ||
|
||
Example | ||
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. At some point in this section, would it make sense to show an example before and after document? I'll leave it up to you to decide but it felt natural to me as a reader since you mentioned the preview section |
||
------- | ||
|
||
The following example uses the | ||
:ref:`sample_mflix dataset <sample-data>`. | ||
|
||
This example updates the ``tomatoes.viewer.numReviews`` and | ||
``tomatoes.viewer.meter`` fields with the Compass | ||
:guilabel:`Update Documents` modal. | ||
|
||
Apply a filter in the :guilabel:`Query Bar` to filter movies which | ||
have a ``year`` of ``1917``. | ||
|
||
.. code-block:: javascript | ||
|
||
{ 'year' : 1917 } | ||
|
||
Click the :icon-lg:`Edit` :guilabel:`Update` button, the :guilabel:`Update Documents` | ||
modal displays. | ||
|
||
In the :guilabel:`Update` text box, paste the following syntax: | ||
|
||
.. code-block:: javascript | ||
|
||
{ | ||
$inc: { "tomatoes.viewer.numReviews" : 1}, | ||
$set: { "tomatoes.viewer.meter" : 99 } | ||
} | ||
|
||
This syntax: | ||
|
||
- :manual:`Increments </reference/operator/update/inc>` the | ||
``tomatoes.viewer.numReviews`` field by ``1``. | ||
- :manual:`Sets </reference/operator/update/set>` the | ||
``tomatoes.viewer.meter`` field to ``99``. | ||
|
||
The :guilabel:`Preview` section populates with sample documents | ||
affected by the update query. | ||
|
||
To view the updates to the :guilabel:`numReviews` | ||
and :guilabel:`meter` fields: | ||
|
||
- Click the :icon-fa5:`angle-right` arrow icon next to | ||
:guilabel:`tomatoes`. | ||
- Click the :icon-fa5:`angle-right` arrow icon next to | ||
:guilabel:`viewer`. | ||
|
||
Click the :guilabel:`Update Documents` button to update the collection's | ||
data. | ||
|
||
Learn More | ||
---------- | ||
|
||
- :ref:`compass-bulk-delete` | ||
- :ref:`saved-favorite-query-view` |
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.
Hmm. The documentation refers to this as "modify multiple" throughout and we refer to it as update or bulk update. And for single ones we refer to it as "edit". I don't know if this matters.
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 think this could be a situation where we are describing the functionality vs the feature name. Similar to how we labeled the Generative AI stuff as "Query with Natural Language" to better articulate the use case. Do you have any preference here @jaoppenheim? Does it need to be labeled bulk updates or is "modify multiple" sufficient?
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 think modify is fine since that is the language that we already have in our docs today