Repository navigation
Generate find projections - #4596
Open
evanchooly wants to merge 1 commit into
Open
evanchooly wants to merge 1 commit into
evanchooly wants to merge 1 commit into
Conversation
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.
Stacked on #4595. Self-reviewed only.
What this solves
Every find whose page documents a projection was a gap: "a documented projection is not generated yet". That was the largest remaining reason in
gaps.json(17 examples). For example,db.movies.find( { "imdb.rating": { $type: "string" }, year: 2013 }, { _id: 0, title: 1, year: 1, "imdb.rating": 1 } )was skipped, though Morphia can write that projection, and its filter already bound after #4595.10 cases now generate (477 → 487): four
$text, three$type, two$neand one$in.Integration: 499 tests under Critter, then reflection, 0 failures. Audits suite: 444 tests, 0 failures, 4 skipped.
How
A find's documented projection becomes the
FindOptionspassed torunner.find, which already compares Morphia's mapped projection with the page's. Before the result comparisons, the runner also runs the documented projection through the driver.0,1,trueandfalsebecome.projection().include(...)and.projection().exclude(...).Projection.mapwrites inclusions, then exclusions. The only reorder that can happen is a lone_id: 0moving after the inclusions, whichPROJECT_ID_FIRSTalready equates.true/falsetakePROJECTION_FLAGS.$meta: a projection that is only{f: {$meta: k}}becomesproject(Meta.k("f")), for the keywordsMetahas a factory for (textScore,indexKey,searchScore,searchHighlights).$slice,$elemMatchand expression values;$metabeside other fields, whichProjectionrejects;_id;Projection.mapwrites as Int32.Decisions for review
$metafinds are reviewed exclusions. Serialization and behavior pass for both:textScore: the find has no sort, and two matches tie on score. The page prints one order and the server returns another.indexKeyin a find: the seed documents have no_id, so the server generates ObjectIds. The page prints those from its own run.ordered = true). A find or pipeline without a sort could compare them unordered instead, which would be more correct for cases like thetextScoreone. That would change every generated scenario, so I left it for a separate change if you want it.Review
Codex, two local rounds. Round 1 found the Int64 and Double flag case, which is now a gap with a regression case. Round 2 was clean.
The design doc and the progress log are updated.