datastore: Support excludeFromIndexes for primitives in arrays.#2773
Closed
beaulac wants to merge 2 commits intogoogleapis:masterfrom
Closed
datastore: Support excludeFromIndexes for primitives in arrays.#2773beaulac wants to merge 2 commits intogoogleapis:masterfrom
beaulac wants to merge 2 commits intogoogleapis:masterfrom
Conversation
Contributor
|
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! |
Contributor
|
Ah thank you @beaulac ! This has been a much wanted resolution. |
Contributor
|
@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! :) |
3 tasks
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
excludeFromIndexespath 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
excludePathFromEntityis becoming rather convoluted. If you'd prefer, I'd be happy to extract it into something that's more manageable.