-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix(NODE-3452): readonly filters not permitted by typings #2927
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.
Also, are we addressing the user's find override request?
by the way we should be able to configure the output type since with a filter we can have a different type than the schema type.
or is that addressed with the other projection ticket?
Co-authored-by: Daria Pardue <[email protected]>
Co-authored-by: Daria Pardue <[email protected]>
src/utils.ts
Outdated
indexes.push(key + '_' + indexSpec[key]); | ||
fieldHash[key] = indexSpec[key]; | ||
indexes.push(key + '_' + (indexSpec as any)[key]); | ||
fieldHash[key] = (indexSpec as any)[key]; |
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.
Hi! Me again, hope I'm not bothering. Can you (in the interim, per the above conversation) fix needing to add the as any
bit by iterating over the result of Object.entries
instead? The following seems to make the transpiler happy:
Object.entries(indexSpec).forEach(([key, value]) => {
indexes.push(key + '_' + value);
fieldHash[key] = value;
});
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.
Good suggestion! thanks :)
Under certain usages typescript will disallow readonly arrays, when overriding the results of a find is a notable usage, look to the tests for a more complete list. Additionally the result of find was resulting the in the schema unioned with filter operators, there's a test to confirm that no longer occurs.