Repository navigation
Generate find and update cases from query and update pages - #4574
Open
evanchooly wants to merge 1 commit into
Open
evanchooly wants to merge 1 commit into
evanchooly wants to merge 1 commit into
Conversation
The query/filters and query/updates families are generated: a find becomes runner.find with the filter's Filters calls, an update runner.update with the filter and one UpdateOperators call per field. The runner gains option-free find and update overloads, and a new UPDATE binding position covers the field update operators. Query and update operands are data, so their arrays are lists rather than array expressions. Two cases are generated, integrated under both mappers and promoted; a third is excluded because its page prints the whole collection after the update, not the documents the filter still matches.
This branch has not been deployed
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.
Step 5 of the operator-audit plan: find and update generation. Stacked on #4573.
Problem
The generator emitted only aggregation pipelines. Every unowned example on the query and update pages (
$in,$type,$[],$[<identifier>], ...) was a gap reading "a FIND action is not generated yet" or "an UPDATE action is not generated yet".Change
OperatorCaseRunnergainsfind(case, query -> ...)andupdate(case, query -> ..., UpdateOperator...)without a legacy-options check. The existing overloads check the legacy options, then delegate to these.runner.aggregate(...), as before;runner.find(case, (query) -> query.filter(gt("qty", 20))), reusing the$matchfilter emission from Generate $match, $group and $sort pipelines and sample-dataset cases #4572;runner.update(case, (query) -> query.filter(eq("_id", 1)), inc("qty", 2), set("tags", List.of("b"))), with one call per field.UPDATEposition uses theFIELDform:$set,$inc,$mul,$max,$min,$unset,$rename,$addToSet,$push,$pull,$pullAll, all verified against core's API.NumberandListparameters take literals. Query and update operands are data, so their arrays areList.of(...);array(...)stays for expression arguments.generation-review.jsonenables thequery/filtersandquery/updatesfamilies.Result
$in's "Match Values in an Array" and$[]'s "Update All Elements in an Array". That makes 14 generated cases.$[]'s "Update Arrays Specified Using a Negation Query Operator". Its serialization and behavior pass, but the page prints the whole collection after the update, while the runner's update results are the documents the filter still matches (the legacy convention). The reason is recorded, and "update results as the page reads them" is on the remaining-work list.arrayFilters(5). Those are the plan's deferred cutover features, next.Decisions for review
$unset'sunset(String, String...)emitsunset("f"), and integration's strict serialization check would catch it if Morphia then wrote a different value than the page.Verification
GeneratorTest.findsAndUpdatesAreGenerated: a find and a multi-operator update emitted with the committed bindings, plus the projection and pipeline-update gaps.Self-reviewed only: the independent reviewers are out of quota until 2026-11-26.