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

PHPLIB-1192: Remove useCursor option in aggregate #1130

Merged
merged 2 commits into from
Jul 17, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jul 14, 2023

PHPLIB-1192

I came across this while working on codecs, and removing this legacy logic makes the logic significantly simpler.

@alcaeus alcaeus requested a review from jmikola July 14, 2023 12:32
@alcaeus alcaeus self-assigned this Jul 14, 2023
}
$cmd['cursor'] = isset($this->options["batchSize"])
? ['batchSize' => $this->options["batchSize"]]
: new stdClass();
Copy link
Member

Choose a reason for hiding this comment

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

I assume always supplying a cursor option for the explain option is kosher?

Quoting Aggregate: Example from the server docs:

MongoDB 3.6 removes the use of aggregate command without the cursor option unless the command includes the explain option. Unless you include the explain option, you must specify the cursor option.

It doesn't say anything about explain prohibiting a cursor option, but cursor does seem to be ignored. Do you think we should gate this with a ! $this->isExplain condition?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd leave the option in unless explain specifically prohibits it - this is consistent with other commands where we also send batchSize as part of an explain.

src/Operation/Aggregate.php Show resolved Hide resolved
src/Operation/Aggregate.php Outdated Show resolved Hide resolved
``result`` array from the command response document. In both cases, the return
value will be :php:`Traversable <traversable>`.
:phpmethod:`MongoDB\\Collection::aggregate()`'s returns a
:php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` object.
Copy link
Member

Choose a reason for hiding this comment

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

I suppose this applies regardless of whether explain: true is used. SGTM.

@alcaeus alcaeus force-pushed the phplib-1192-remove-usecursor branch from 9ba7b15 to f56ae4e Compare July 17, 2023 07:28
@alcaeus alcaeus requested a review from jmikola July 17, 2023 07:28
@alcaeus alcaeus force-pushed the phplib-1192-remove-usecursor branch from f56ae4e to 5631bd8 Compare July 17, 2023 07:43
@alcaeus alcaeus merged commit 5aff53f into mongodb:master Jul 17, 2023
@alcaeus alcaeus deleted the phplib-1192-remove-usecursor branch July 17, 2023 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants