Skip to content

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

Merged
merged 75 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
be8fdb5
DOCSP-34569 Bulk Update Task Page
ianf-mongodb Nov 20, 2023
0a6b621
*
ianf-mongodb Nov 20, 2023
11d662f
*
ianf-mongodb Nov 20, 2023
954e75b
*
ianf-mongodb Nov 20, 2023
6fb0c0b
*
ianf-mongodb Nov 20, 2023
42c3187
*
ianf-mongodb Nov 20, 2023
0901486
*
ianf-mongodb Nov 20, 2023
985017b
*
ianf-mongodb Nov 20, 2023
62977fd
*
ianf-mongodb Nov 20, 2023
21272fe
*
ianf-mongodb Nov 20, 2023
845d8c2
*
ianf-mongodb Nov 20, 2023
c4393df
*
ianf-mongodb Nov 20, 2023
a1a3a26
*
ianf-mongodb Nov 20, 2023
c561439
*
ianf-mongodb Nov 20, 2023
31d516d
*
ianf-mongodb Nov 21, 2023
1bfe275
*
ianf-mongodb Nov 21, 2023
1232f31
*
ianf-mongodb Nov 21, 2023
068ab61
*
ianf-mongodb Nov 21, 2023
c12bda0
*
ianf-mongodb Nov 21, 2023
971d5e8
*
ianf-mongodb Nov 22, 2023
8cad6a2
*
ianf-mongodb Nov 22, 2023
41a0083
*
ianf-mongodb Nov 22, 2023
538a0a5
*
ianf-mongodb Nov 22, 2023
ef870dd
*
ianf-mongodb Nov 22, 2023
e1b9ba5
*
ianf-mongodb Nov 22, 2023
ecec615
*
ianf-mongodb Nov 22, 2023
10e4155
*
ianf-mongodb Nov 22, 2023
c641443
*
ianf-mongodb Nov 22, 2023
f452a60
*
ianf-mongodb Nov 22, 2023
2fd9fdf
*
ianf-mongodb Nov 22, 2023
e47f563
*
ianf-mongodb Nov 22, 2023
604086f
*
ianf-mongodb Nov 22, 2023
7b86709
*
ianf-mongodb Nov 22, 2023
7f03dfe
*
ianf-mongodb Nov 22, 2023
cae8620
*
ianf-mongodb Nov 22, 2023
e7e7299
*
ianf-mongodb Nov 22, 2023
78386e6
*
ianf-mongodb Nov 22, 2023
1c8e23d
*
ianf-mongodb Nov 22, 2023
b5e6987
*
ianf-mongodb Nov 22, 2023
1927a90
*
ianf-mongodb Nov 22, 2023
095acf5
*
ianf-mongodb Nov 22, 2023
6ea9f20
*
ianf-mongodb Nov 22, 2023
bcf28d9
*
ianf-mongodb Nov 22, 2023
481beba
*
ianf-mongodb Nov 22, 2023
b8f82d3
*
ianf-mongodb Nov 29, 2023
68412f0
*
ianf-mongodb Nov 29, 2023
9357e1e
*
ianf-mongodb Nov 29, 2023
4b7f0db
*
ianf-mongodb Nov 29, 2023
a93a4d3
*
ianf-mongodb Nov 29, 2023
33e09d9
*
ianf-mongodb Nov 29, 2023
be9e119
*
ianf-mongodb Nov 29, 2023
9cd767a
*
ianf-mongodb Nov 29, 2023
7f15431
*
ianf-mongodb Nov 29, 2023
e617a8b
*
ianf-mongodb Nov 29, 2023
ec0f84d
*
ianf-mongodb Nov 29, 2023
5ee99e1
Apply suggestions from code review
ianf-mongodb Nov 29, 2023
93072e5
*
ianf-mongodb Nov 29, 2023
981f7b5
*
ianf-mongodb Nov 29, 2023
5480bd0
*
ianf-mongodb Nov 29, 2023
ff22e41
*
ianf-mongodb Nov 29, 2023
812c952
*
ianf-mongodb Nov 29, 2023
8a17df1
*
ianf-mongodb Nov 29, 2023
faa46d0
*
ianf-mongodb Nov 29, 2023
8871958
*
ianf-mongodb Nov 29, 2023
4d6c4ed
*
ianf-mongodb Dec 1, 2023
10025ce
Apply suggestions from code review
ianf-mongodb Dec 6, 2023
561e7cf
*
ianf-mongodb Dec 6, 2023
0adb56a
*
ianf-mongodb Dec 6, 2023
9eec497
*
ianf-mongodb Dec 6, 2023
6510faa
*
ianf-mongodb Dec 6, 2023
28d40ae
*
ianf-mongodb Dec 6, 2023
9f22150
*
ianf-mongodb Dec 6, 2023
c1db844
*
ianf-mongodb Dec 6, 2023
3753387
*
ianf-mongodb Dec 6, 2023
a50ea59
*
ianf-mongodb Dec 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions source/documents.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ Documents are individual records in a MongoDB :ref:`collection

From the :guilabel:`Documents` tab, you can
:ref:`view <compass-view-documents>`, :ref:`insert <insert-documents>`,
:ref:`modify <compass-modify-documents>`,
:ref:`clone <clone-documents>`, and
:ref:`delete <compass-delete-documents>` documents in your selected
collection or view.
:ref:`modify <compass-modify-documents>`,
:ref:`modify multiple <compass-bulk-update>`,
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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

:ref:`clone <clone-documents>`,
:ref:`delete <compass-delete-documents>`, and
:ref:`delete multiple <compass-bulk-delete>`
documents in your selected collection or view.

.. note::

.. include:: /includes/extracts/query-bar-results.rst
For query result sets larger than 20 documents, Compass shows
paginated results. By default, pages display 20 documents at a time.

From the :ref:`query bar <query-bar>`, you can specify a query to
filter the displayed documents. Click :guilabel:`Options` to
Expand All @@ -31,8 +34,10 @@ specify query options.
- :doc:`/documents/view`
- :doc:`/documents/insert`
- :doc:`/documents/modify`
- :ref:`compass-bulk-update`
- :doc:`/documents/clone`
- :doc:`/documents/delete`
- :ref:`compass-bulk-delete`

.. toctree::
:titlesonly:
Expand Down
153 changes: 152 additions & 1 deletion source/documents/modify-multiple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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`
Binary file modified source/images/compass/query-history-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 26 additions & 1 deletion source/includes/fact-viewing-favorite-queries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,29 @@

.. step:: Click the :guilabel:`Favorites` button in the past queries pane.

Select favorite queries.
Select your favorited operation.

- If your favorited operation is a query, only a :guilabel:`Filter`
statement displays in the :guilabel:`Favorites` list view
along with copy :icon-lg:`Copy` and delete :icon-lg:`Trash`
icons.

.. note::

Clicking a favorited query in the
:guilabel:`Favorites` list view populates your
:guilabel:`Query Bar` with that query.

- If your favorited operation is a bulk update statement, a
:guilabel:`Filter` and :guilabel:`Update` statement display in
the :guilabel:`Favorites` list view along with copy
:icon-lg:`Copy`, delete :icon-lg:`Trash`, and
:icon-lg:`OpenNewTab` open in modal icons.

.. note::

Clicking the :icon-lg:`OpenNewTab` icon opens the bulk
update statement and the filter criteria in the
:guilabel:`Update Documents` modal. For details on bulk
update statements in Compass, see
:ref:`compass-bulk-update`.
2 changes: 2 additions & 0 deletions source/query/queries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ When you click a saved or favorite pipeline tile, Compass opens the
:figwidth: 720 px
:alt: My queries view

.. _saved-favorite-query-view:

Using the :guilabel:`Favorites` Tab
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down