-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DOCSP-35975: Update many usage example #2836
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-35975: Update many usage example #2836
Conversation
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, a couple questions and suggestions!
docs/usage-examples/updateMany.txt
Outdated
:class: singlecol | ||
|
||
You can update multiple documents in a collection by calling the ``update()`` method | ||
on an Eloquent model or query builder. |
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.
Question:
Is it possible to call on the model directly? I could be wrong, but I think you need to chain it to an object collection like the result of "where()" for Laravel MongoDB.
I think this description should match what's shown in the example either way.
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.
Ah yes, it needs to be on an object collection - fixed
- Uses the ``Movie`` Eloquent model to represent the ``movies`` collection in the | ||
``sample_mflix`` database | ||
- Updates documents from the ``movies`` collection that match a query filter |
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.
Similar to prior feedback, I think printing the output should be mentioned or the code that prints should be hidden.
docs/usage-examples/updateMany.txt
Outdated
To learn more about updating data with {+odm-short+}, see the `Updates | ||
<https://laravel.com/docs/{+laravel-docs-version+}/eloquent#updates>`__ section of the | ||
Laravel documentation. |
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.
Question:
Do you know if all the content in this section is available in Laravel MongoDB? For example, do the methods listed in the "Examining Attribute Changes" section work?
If these do not work, perhaps this link should be omitted.
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.
They don't seem to work, so I'll remove
docs/usage-examples/updateMany.txt
Outdated
- ``where()``: matches documents in which the value of the ``imdb.rating`` nested field | ||
is greater than ``9`` | ||
- ``update()``: updates the matching documents by adding an ``acclaimed`` field and setting | ||
its value to ``true`` |
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.
Suggestion:
I think it could be helpful to add some information about the value printed even if it seems self-explanatory. E.g.
"The update() method returns the number of documents successfully updated"
|
||
.. tip:: | ||
|
||
To learn more about updating data with {+odm-short+}, see the :ref:`laravel-fundamentals-modify-documents` |
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.
Note: since this links to a section of the Write operations page, this PR will be merged after #2808
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
Adds a usage example showing how to update multiple documents
JIRA - https://jira.mongodb.org/browse/DOCSP-35975
Staging - https://preview-mongodbnorareidy.gatsbyjs.io/laravel/DOCSP-35975/usage-examples/updateMany/
Checklist