This repository was archived by the owner on Jan 30, 2023. It is now read-only.
Schema Views (aka schema defined aggregations) #83
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.
This would add support for arbitrary
aggs
defined as part of schemas. It's effectively the same as creating a non-materialized view, but we've discussed this enough times that it makes sense to have this PR open as a discussion point.You'd use it like this, which shows an example of performing a lookup before running any other filters:
An alternative to this might be explicit support for
$lookup
only, because we can optimize better than Mongo could natively. The idea would be to only run the lookup only if needed and as late as possible - up front if it's needed for filters, after the filters if it's only needed for results, and not at all if the results don't need it. We'd likely add an API for node types to specify their lookup dependencies so we don't resort to something naive like a regex/string includes on a stringified Mongo blob 😂