feat(mongodb): Add pagination metadata to the aggregation results#6912
Merged
soyuka merged 4 commits intoapi-platform:4.1from Jan 29, 2025
Merged
feat(mongodb): Add pagination metadata to the aggregation results#6912soyuka merged 4 commits intoapi-platform:4.1from
soyuka merged 4 commits intoapi-platform:4.1from
Conversation
GromNaN
commented
Jan 10, 2025
Comment on lines
-30
to
-31
| public const LIMIT_ZERO_MARKER_FIELD = '___'; | ||
| public const LIMIT_ZERO_MARKER = 'limit0'; |
Contributor
Author
There was a problem hiding this comment.
This constants are removed. They should have been marked as internal. We can keep them for backward compatibility, but they are useless now that they are not used in the aggregation pipeline.
aeb7cc3 to
eaa37fe
Compare
Member
|
It looks like the patch is responsible for the failing CI |
56c3a0e to
adc939b
Compare
GromNaN
commented
Jan 17, 2025
| "doctrine/dbal": "^4.0", | ||
| "doctrine/doctrine-bundle": "^2.11", | ||
| "doctrine/mongodb-odm": "^2.6", | ||
| "doctrine/mongodb-odm": "^2.9.2", |
Contributor
Author
There was a problem hiding this comment.
Required for mocking AddFields. See release 2.9.2
dd44008 to
abfa2e9
Compare
Contributor
Author
|
Thanks to Behat tests. I had totally misunderstood the meaning of limit=0. I thought it meant “infinite”, whereas it actually means zero (I think it should be a error to put zero results per page, but maybe there's a use case). So, to solve this problem, I add an empty array directly to the results rather than building a query that returns nothing. |
abfa2e9 to
b2c2212
Compare
Member
|
Thanks @GromNaN ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simplifies code by removing the need to extract
firstResultandmaxResultsfrom the pipeline, by adding a$setFieldsstage to add the litteral informations.This also remove references to the MongoDB
Cursorand theUnitOfWorkstored in thePaginatorclass. I hope this helps preventing memory leak issues.Since I'm modifying the aggregation pipeline, the parameters of the
Paginatorconstructor and deleting 2 constants from thePaginatorclass, it's best not to merge this as a bugfix.