-
Notifications
You must be signed in to change notification settings - Fork 34
DOCSP-41956: run a command #129
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-41956: run a command #129
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.
Nice job! Just a few suggestions
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!
Hi @GromNaN Please re-review this PR when you have a moment! |
14d08cb
to
bdc0a10
Compare
✅ Deploy Preview for docs-php-library ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
bdc0a10
to
160470c
Compare
source/run-command.txt
Outdated
If the number of documents in the command response is sufficiently large, you | ||
can run a :manual:`getMore </reference/command/getMore/>` command to | ||
retrieve the next batch of results from the cursor by using the cursor | ||
ID. |
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.
Remove this paragraph, as the driver handles this on its own. When you iterate the cursor beyond a batch, the driver will issue a getMore
to pull in the next batch for continued iteration. When the cursor ID comes back as zero, the driver knows not to issue further getMore
commands and prohibits further iteration beyond whatever remains in the last batch.
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 see - this applies only for the shell method I guess? Misunderstood a comment you made in the previous review.
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 behavior in PHPLIB's Database::command()
(and PHPC's executeCommand()
) method is probably unique. Other drivers may have a separate method for the envelope handling (see: runCursorCommand in the driver spec).
AFAIK, db.runCommand()
returns the raw response with no envelope unpacking, and I don't think the shell has a command cursor variant. I'm also not aware of any way in the shell to construct a cursor object from a raw response, so a script written for mongosh would probably need to manually execute getMore
commands.
But more generally, if you have a cursor object in the driver or shell, you can trust that it will use getMore
as needed to continue iteration. And db.runCommand()
does not give you a cursor.
b584444
to
8918fbf
Compare
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-41956
Staging - https://deploy-preview-129--docs-php-library.netlify.app/run-command/
Self-Review Checklist