-
Notifications
You must be signed in to change notification settings - Fork 29
DOCSP-44849: modify results #59
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-44849: modify results #59
Conversation
✅ Deploy Preview for docs-mongoid ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
nothing critical, but i'm curious about enough stuff that i'd like to see it again!
You can pass fields of referenced associations to the ``only()`` method, | ||
but the projection is ignored when loading the embedded objects. {+odm+} | ||
loads all fields of the referenced associations. |
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.
Q: might be my lack of ruby experience, but i'm still not sure i understand this paragraph. will ruby people get it?
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.
It means that even if you project only one field of an embedded document, the whole thing will load when you access it from the result. I can reword
If you chain sort specifications, the first call defines the most | ||
significant criteria and the newest call defines the least significant | ||
one. |
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.
Q: does most/least significant mean the order in which ruby will try to sort the fields by (sort the most significant, then second most, etc.)? I just haven't heard these terms before.
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.
Ill reword
.. note:: Sorting in Scopes | ||
|
||
If you define a scope on your model that includes a sort specification, | ||
the scope sort takes precedence over the sort specified in a query, as the |
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: as
the scope sort takes precedence over the sort specified in a query, as the | |
the scope sort takes precedence over the sort specified in a query, because the |
---------------- | ||
|
||
{+odm+} provides the ``limit()``, ``skip()``, and ``batch_size()`` | ||
pagination operators that you can use on ``Criteria`` objects. The |
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.
Q: operators vs methods?
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 are interchangeable
You can limit the number of results that {+odm+} returns by using the | ||
``limit()`` method. |
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: slight ambiguity between you using the limit() method and mongoid using it
You can limit the number of results that {+odm+} returns by using the | |
``limit()`` method. | |
You can use the ``limit()`` method to limit the number of results that {+odm+} returns. |
method, or its alias ``offset()``. If you chain a ``limit()`` call, it | ||
is applied after documents are skipped. |
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: might be useful to have an example or admonition for this, actually! probably a common question.
method, or its alias ``offset()``. If you chain a ``limit()`` call, it | |
is applied after documents are skipped. | |
method, or its alias ``offset()``. If you chain a ``limit()`` call | |
to the ``skip()`` method, the limit | |
is applied after documents are skipped. |
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!
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-44849
Staging - https://deploy-preview-59--docs-mongoid.netlify.app/interact-data/modify-results/
Self-Review Checklist