-
Notifications
You must be signed in to change notification settings - Fork 598
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
datastore: Support excludeFromIndexes for primitives in arrays. #2773
datastore: Support excludeFromIndexes for primitives in arrays. #2773
Conversation
This looks good to me. I added the scenario into the system tests (the tests that run against the actual API). Only problem now is that we're blocked for a short time while we are extracting the Datastore module into its own repo (soon to be https://github.com/googleapis/nodejs-datastore). After that, I'll port the PR over, and get it released ASAP. Thank you for helping out! |
Ah thank you @beaulac ! This has been a much wanted resolution. |
@beaulac The other repo is now open: https://github.com/googleapis/nodejs-datastore -- I plan to port your work this week, but if you're willing, feel free to beat me to it! :) |
Resolves #2615 .
This slightly modifies the index exclusion syntax discussed in #1916, which was merged in #2497.
Primitives in an array can now be excluded from indexes like this:
Previously,
excludeFromIndexes: ['array[]']
would have thrown a server-side error because it was interpreted as excluding the arrayValue itself from indexes, which is disallowed by the Datastore API.This PR changes this behaviour: now, an
excludeFromIndexes
path ending with[]
means that non-entity values in the array should be excluded.To exclude properties of entities in arrays, the existing nested-property syntax (e.g.
array[].name
) is still used.For example, to exclude both from indexes:
Nested arrays remain unsupported. The following will still break, as it currently does:
I wanted to change as little as possible of how entity properties are excluded, since there is no clear conclusion on how #2510 ("catch-all" index-exclusion) will be addressed. As such, I didn't want to redo the core implementation, but I realize that
excludePathFromEntity
is becoming rather convoluted. If you'd prefer, I'd be happy to extract it into something that's more manageable.