Repository navigation
Generate $match, $group and $sort pipelines and sample-dataset cases - #4572
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 generator binds query filters ($match with $eq, $ne, $gt, $gte, $lt, $lte, $in and $exists), $group, $sort, $unwind, the ranked and n-valued accumulators, $map and $convert, and array literals. Generated scenarios declare the form rules their spelling needs. An example that seeds nothing and queries a reviewed sample collection names its dataset and skips its results checks, so only its serialization is checked; the runner accepts a dataset only with that skip. Ten documented examples are now generated, integrated under both mappers and promoted.
This was referenced Nov 23, 2026
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: bindings for the gaps the weekly job files. Stacked on #4571, the Morphia fix this work found.
Problem
After #4570, the inventory showed 115 unowned examples, but the generator produced only one case. The gaps:
stage $match has no binding.$matchtakes a query document, which the generator couldn't emit as MorphiaFilters.$group,$sortor accumulators. Behind$matchwere$group(17), the ranked and n-valued accumulators ($top,$bottomN,$firstN,$maxN, ...),$sortand$unwind.sample_mflixdataset and seed nothing. The runner can't load that dataset, so even with bindings their results can't be checked.Change
Binding forms (
DslBindings, verified against core's API as before):FILTERS($match){genres: "Short", year: {$gte: 2010, $lte: 2012}}match(eq("genres", "Short"), gte("year", 2010), lte("year", 2012))FIELD(newFILTERposition){$in: [...]},{$exists: true}in("rated", List.of(...)),exists("imdb.rating")GROUP{_id: "$year", best: {...}}group(id("$year")).field("best", ...)SORT{_id: 1, n: -1}sort().ascending("_id").descending("n")New bindings:
$eq,$ne,$gt,$gte,$lt,$lte,$in,$exists.$match,$group,$sort,$unwind.$top,$bottom,$topN,$bottomN,$firstN,$lastN,$maxN,$minN,$map,$convert.[]entry binding them toArrayExpressions.array, which is how the handwritten tests spell$top's output. Morphia'swraprejects a plainList.The emitter also writes
Iterablearguments asList.of(...)and a sort document asSortvarargs (descending("imdb.rating"), ascending("title")).Declared rules. Morphia writes an implicit equality as
{$eq: v}, and splits several operators on one field into one filter each. A generated scenario declares exactly the rules its spelling needs,EQ_SHORTHANDandFIELD_OPERATORS_AND, the same reviewed rules converted cases use.Sample-dataset cases.
generation-review.jsongainssampleDatasets(movies→sample_mflix).dataset: "sample_mflix"andskipped.resultswith the reason, so only its serialization is checked: Morphia must still build exactly the documented pipeline.OperatorCaseRunneraccepts a dataset only alongside that skip.Result
$top×2,$bottom×2,$topN,$bottomN,$firstN,$maxNand$minN. They were integrated under both mappers in a clean worktree, then promoted. The manifest now lists 11 generated cases.$topN/$bottomNwrotesortByas an array. That's fixed separately in Encode a ranked accumulator's sortBy as one document #4571.$serializeEJSON,$deserializeEJSON,$toObject,$toArray,$hexHash,$percentile,$limit,$type, a compound$group_id, two$convertoptions, and$reduce'svalueAs.Decisions for review
sample_mflixinto the test server would be a large fixture for little gain. The alternative is leaving these examples unchecked. The scenario names the dataset and the skip, so nothing passes quietly.$typestays a gap. Morphia'sTypeconstants are named by BSON type number (INTEGER_32), not by MQL alias (int), so it needs a reviewed alias map rather than the upper-casing thatConvertTypehappens to match.Verification
GeneratorTest.sampleDatasetExamplesCheckTheirSerializationruns the committed catalog over a page and checks:$group,$topwith two sort keys, and$sort;_id,$exists: falseand$type.Self-reviewed only: the independent reviewers are out of quota until 2026-11-26.