-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DOCSP-35962: sorts #2879
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-35962: sorts #2879
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! Left one suggestion.
**descending** sort direction on results. By default, the ``orderBy()`` | ||
method sets an ascending sort on the supplied field name. To specify a | ||
descending sort, pass ``'desc'`` as the second parameter. |
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 the orderBy() method also accepts `asc' for ascending sort. It could be helpful to let the know the user exists (for completeness) and to mention that it's not necessary since it's the default value. I think keeping the asc examples as-is is fine though.
|
||
- :manual:`Natural order </reference/glossary/#std-term-natural-order>` | ||
in the Server manual glossary | ||
- `Ordering, Grouping, Limit and Offset <https://laravel.com/docs/10.x/queries#ordering-grouping-limit-and-offset>`__ |
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.
The Laravel version in the doc url needs to be updated to 11.x for laravel-mongodb 4.2
|
||
.. code-block:: php | ||
|
||
$movies = Movie::where('countries', 'Indonesia') |
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.
Could you move the examples to a test?
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 will move the query syntax examples into a test, but I'm not sure how to move the Controller method snippets into include files.
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.
Ok, let's keep the controller example here for now.
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 after fixing the Laravel doc link.
|
||
- :manual:`Natural order </reference/glossary/#std-term-natural-order>` | ||
in the Server manual glossary | ||
- `Ordering, Grouping, Limit and Offset <https://laravel.com/docs/11.x/queries#ordering-grouping-limit-and-offset>`__ |
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.
That may be a subject to be dealt with separately, but we can't freeze the version like that. How to update the links when a new Laravel version is released? Perhaps the easiest way is to link to the latest version. But you run the risk of having a broken link.
- `Ordering, Grouping, Limit and Offset <https://laravel.com/docs/11.x/queries#ordering-grouping-limit-and-offset>`__ | |
- `Ordering, Grouping, Limit and Offset <https://laravel.com/docs/queries#ordering-grouping-limit-and-offset>`__ |
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.
We can link to the latest version, or we can store the laravel version as a source constant. Either way, the risk of linking to a broken link is there, so I'll update to just use latest for now.
// end-sort | ||
|
||
$this->assertNotNull($movies); | ||
$this->assertCount(4, $movies); |
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've added fixtures to make the tests work. But I had to update the expected number of results, so we don't have too much data to load.
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.
Thanks for fixing the tests!
// end-first | ||
|
||
$this->assertNotNull($movie); | ||
$this->assertInstanceOf(Movie::class, $movie); |
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've renamed $movies
into $movie
, as a single object is expected. Not a list of 1.
|
||
.. code-block:: php | ||
|
||
$movies = Movie::where('countries', 'Indonesia') |
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.
Ok, let's keep the controller example here for now.
https://jira.mongodb.org/browse/DOCSP-35962
STAGING
DOCS PR
Checklist