-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
aggregate allows a stage type only once #4682
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
Comments
I can't think of a reason to use the same stage more than once, but if it is supported we should have it here. Do you have a pipeline you use that shows this issue? A test case would also help.
During my tests the objects were in order all of the time. I do agree that if we pass around an Array instead order will be guaranteed. |
For instance, you often add a $match (or a project) after a $lookup. |
I get why ordering is essential. My question is about same stages being used more than once. I can submit a PR if you have an example I can test with. |
Ok. I didn't test this code, but it's the global idea:
Say, I want all the datas from group A which are linked to, at least 1 user.
$lookup adds more data on which we can apply new $match or $project stages, for instance. I hope the code makes sense, |
i have this problem too? |
For now, you can use the little workaround I've put above. |
We often need to use a stage type (specially project and match) several times in the same pipeline, but the JS-SDK's ParseQuery (the Node part of course) prevents it in its aggregate method:
Note that, unlike Map, an Object doesn't guaranty order.
For now, I use this workaround:
Hope that helps.
Olivier, from Paris
The text was updated successfully, but these errors were encountered: