-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
AggregationOptions types for aggregate queries broken for sample (any maybe others) #8794
Comments
Thanks for opening this issue!
|
We switched to using the original MongoDB stage names in #7338, so this is expected behavior. If the TS error comes from the TS definition of a 3rd party (outside of the Parse Platform org), then you'd need to open an issue there. |
Oh okay no problem, is @types/parse not managed by you guys? I've raised a ticket with them |
It is not. In fact we are working on parse-community/Parse-SDK-JS#2012 to add our own TS definitions for Parse JS SDK (which is where the If I understand your issue correctly, the TS definition you are using is parsing the pipeline. We do not intend to do that in our own types, because this is native MongoDB syntax that the developer is responsible for checking. |
@mtrezza I agree, and I've just seen it in 4.2.0 alpha and I'm very excited as @types/parse has always been a bit behind. Good typing would nearly remove all need for detailed documentation. |
New Issue Checklist
Issue Description
Parse.Query type definitions broken for AggregationOptions.
In particular sample. This is because the type definitions expect
sample: {
size: 25
}
but to get the actual result you need to use
$sample: {
size: 25
}
This however requires to use @ts-ignore
Steps to reproduce
Create a pipeline of type AggregationOptions with type sample e.g.
Then use an aggregate query.
const query = new Parse.Query(Item);
const randomItems = await query.aggregate(pipeline);
Actual Outcome
ParseError: Invalid aggregate stage 'sample'.
Expected Outcome
List of items
Environment
Server
macOS
Local
Database
MongoDB
6.0.0
Local
Client
Cloud Code Javascript
4.1.0
Logs
The text was updated successfully, but these errors were encountered: