Skip to content

Conversation

@nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Aug 2, 2021

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.

@dariakp dariakp self-assigned this Aug 2, 2021
@dariakp dariakp added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 2, 2021
Copy link
Contributor

@dariakp dariakp left a 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?

nbbeeken and others added 3 commits August 2, 2021 16:57
Co-authored-by: Daria Pardue <[email protected]>
Co-authored-by: Daria Pardue <[email protected]>
@nbbeeken nbbeeken requested a review from dariakp August 2, 2021 21:00
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];
Copy link
Contributor

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;
    });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion! thanks :)

@dariakp dariakp merged commit ce51e78 into 4.0 Aug 3, 2021
@dariakp dariakp deleted the NODE-3452/readonly-arrays branch August 3, 2021 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Primary Review In Review with primary reviewer, not yet ready for team's eyes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants