-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DOCSP-35972: Distinct values usage example #2846
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-35972: Distinct values usage example #2846
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.
approving with some non blocking comments, happy to take another look if need be!
The example calls the following methods on the ``Movie`` model: | ||
|
||
- ``where()``: matches documents in which the value of the ``year`` field is ``1930``. | ||
- ``select()``: retrieves the matching documents' ``imdb.rating`` field values. |
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.
S: is there a better field to select for than a numerical field? Like genre or director maybe?
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.
Sure, changed to the directors field
docs/usage-examples/distinct.txt
Outdated
to the ``select()`` method. Then, call ``distinct()`` to return the unique field values of documents | ||
that match the 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.
to the ``select()`` method. Then, call ``distinct()`` to return the unique field values of documents | |
that match the query filter. | |
to the ``select()`` method. Then, call ``distinct()`` to return the unique values of the selected field in documents | |
that match the 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.
LGTM.
Could you make a note to revisit this page when working on the aggregation builder docs?
@GromNaN |
It should demonstrate how to do almost the same result using an aggregation with a |
Adds a usage example showing how to retrieve distinct field values.
JIRA - https://jira.mongodb.org/browse/DOCSP-35972
Staging - https://preview-mongodbnorareidy.gatsbyjs.io/laravel/DOCSP-35972/usage-examples/distinct/
Checklist