Skip to content
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-38327: add Query Builder examples to usage examples #3259

Open
wants to merge 20 commits into
base: 4.8
Choose a base branch
from

Conversation

rustagir
Copy link
Contributor

@rustagir rustagir commented Jan 30, 2025

https://jira.mongodb.org/browse/DOCSP-38327

adds query builder code examples to usage examples

STAGING - click through each usage example that was changed

Checklist

  • Add tests and ensure they pass

@rustagir rustagir requested a review from a team as a code owner January 30, 2025 15:02
@rustagir rustagir requested a review from norareidy January 30, 2025 15:02
@github-actions github-actions bot added the docs label Jan 30, 2025
@rustagir rustagir force-pushed the DOCSP-38327-add-qb-to-ues branch from e877a17 to 111b290 Compare January 30, 2025 15:24
@rustagir rustagir marked this pull request as draft January 30, 2025 15:24
@rustagir rustagir marked this pull request as ready for review January 30, 2025 21:16
@rustagir rustagir force-pushed the DOCSP-38327-add-qb-to-ues branch from 9fa735d to f498f97 Compare January 30, 2025 21:29
@GromNaN GromNaN changed the title DOCSP-38327: add qb examples to usage exs DOCSP-38327: add Query Builder examples to usage examples Jan 31, 2025
Copy link
Contributor

@jordan-smith721 jordan-smith721 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple real small things but LGTM!

- Inserts documents into the ``movies`` collection
- Prints whether the insert operation succeeds

The example calls the ``insert()`` method to insert documents that model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"model" here confused me here for a minute, I think because I was thinking "a model object" based on the previous bullets

Suggested change
The example calls the ``insert()`` method to insert documents that model
The example calls the ``insert()`` method to insert documents that represent

- Inserts documents into the ``movies`` collection
- Prints whether the insert operation succeeds

The example calls the ``insert()`` method to insert documents that model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The example calls the ``insert()`` method to insert documents that model
The example calls the ``insert()`` method to insert documents that represent

- ``where()``: Matches documents in which the value of the
``title`` field is ``"Carol"``
- ``orderBy()``: Sorts matched documents by their ascending ``_id`` values
- ``first()``: Retrieves only the first matching document.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``first()``: Retrieves only the first matching document.
- ``first()``: Retrieves only the first matching document

@rustagir rustagir requested a review from GromNaN January 31, 2025 19:51
$movies = Movie::where('runtime', '>', 900)
->orderBy('_id')
->get();
// end-find
// end-eloquent-find
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must keep the previous assertion, otherwise your query is not tested.

Suggested change
// end-eloquent-find
// end-eloquent-find
$this->assertEquals(2, $movies->count());

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'll go through an re-add the tests where I missed them!

@rustagir rustagir force-pushed the DOCSP-38327-add-qb-to-ues branch from c047dec to e6136c7 Compare January 31, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants