From fc8183cc6e97e72d2cebeba3ab63495750a5be0d Mon Sep 17 00:00:00 2001 From: evanchooly Date: Mon, 23 Nov 2026 13:51:14 -0500 Subject: [PATCH] Convert or delete the last legacy cases $type's multiple-data-types case converts with alternative commands: the scenario carries the page's other spellings, Morphia's command must equal one, and the reference runs that one. $rand's case converts after its body gains the page's _id exclusion and its ledger entry a reviewed PROJECT_ID_FIRST rule. The three cases whose pages print unparseable results are deleted and recorded. No legacy fixture directory remains. --- audits/README.md | 7 +- audits/catalog/curated-repairs.json | 64 +---- audits/catalog/cutover.json | 18 +- audits/catalog/deleted-fixtures.json | 36 +++ audits/catalog/documented-examples.json | 68 +++-- audits/catalog/fixture-migration.json | 153 ++++++++++++ audits/catalog/form-migration.json | 176 +------------ audits/catalog/form-review.json | 120 +++------ audits/catalog/legacy-references.json | 39 +-- audits/catalog/repair-review.json | 1 - .../audits/repairs/FixtureMigration.kt | 60 +++-- .../morphia/audits/repairs/FormMigration.kt | 21 +- .../audits/offline/CuratedRepairsTest.kt | 2 +- .../audits/offline/FixtureMigrationTest.kt | 45 ++-- .../audits/offline/FormMigrationTest.kt | 4 +- .../dev/morphia/test/OperatorCaseRunner.java | 25 +- .../test/aggregation/expressions/TestTan.java | 24 -- .../test/aggregation/stages/TestDensify.java | 40 --- .../aggregation/stages/TestGraphLookup.java | 15 -- .../morphia/test/query/filters/TestRand.java | 2 +- .../tan/tangentOfValueInRadians/action.json | 10 - .../tan/tangentOfValueInRadians/data.json | 1 - .../tan/tangentOfValueInRadians/expected.json | 1 - .../tan/tangentOfValueInRadians/name | 1 - .../densify/densifyTimeSeriesData/action.json | 10 - .../densify/densifyTimeSeriesData/data.json | 4 - .../densifyTimeSeriesData/expected.json | 10 - .../stages/densify/densifyTimeSeriesData/name | 1 - .../acrossMultipleCollections/action.json | 13 - .../acrossMultipleCollections/data.json | 3 - .../acrossMultipleCollections/data2.json | 5 - .../acrossMultipleCollections/expected.json | 3 - .../acrossMultipleCollections/name | 1 - .../dev/morphia/test/example-bindings.json | 21 -- .../dev/morphia/test/generated/manifest.json | 18 ++ .../action.json | 6 - .../data.json | 10 - .../expected.json | 4 - .../selectRandomItemsFromACollection/name | 1 - .../scenario.json | 235 ++++++++++++++++++ .../queryingByMultipleDataTypes/action.json | 1 - .../queryingByMultipleDataTypes/data.json | 4 - .../queryingByMultipleDataTypes/expected.json | 3 - .../type/queryingByMultipleDataTypes/name | 1 - .../queryingByMultipleDataTypes/scenario.json | 168 +++++++++++++ design/operator-audits-design.md | 7 +- design/operator-audits-progress.md | 22 +- 47 files changed, 839 insertions(+), 645 deletions(-) delete mode 100644 core/src/test/java/dev/morphia/test/aggregation/expressions/TestTan.java delete mode 100644 core/src/test/java/dev/morphia/test/aggregation/stages/TestDensify.java delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/action.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/data.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/expected.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/name delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/action.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/data.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/expected.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/name delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/action.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data2.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/expected.json delete mode 100644 core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/name delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/action.json delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/data.json delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/expected.json delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/name create mode 100644 core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/scenario.json delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/action.json delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/data.json delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/expected.json delete mode 100644 core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/name create mode 100644 core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/scenario.json diff --git a/audits/README.md b/audits/README.md index 590b09343a1..753581d8e29 100644 --- a/audits/README.md +++ b/audits/README.md @@ -169,11 +169,10 @@ These remain because coverage has not fully moved off them yet. Each one goes wh its users does. - **Core's legacy fixture loader** (`data.json`, `action.json`, `expected.json` through - `TemplatedTestBase`). It runs 5 legacy fixture directories, each with a documented source: 4 - tracked as legacy-only in `cutover.json` with the strict check they fail, and one declaration - that needs alternative commands. 384 cases have moved to the runner; the 167 legacy tests whose + `TemplatedTestBase`). No legacy fixture directory remains: 386 cases have moved to the runner; the 167 legacy tests whose fixtures no documented source reproduced were deleted and are recorded in - `audits/catalog/deleted-fixtures.json`. + `audits/catalog/deleted-fixtures.json`, with the three whose pages print results that do not + parse. The loader code itself retires next. - **The legacy RST extractor** (`rst/`, `model/CodeBlock`). Cutover and the example inventory read pages through it, with tested snippets spliced in and only the mongosh content of each language choice kept. It goes once the structured parser (`scenarios/`) owns example extraction, diff --git a/audits/catalog/curated-repairs.json b/audits/catalog/curated-repairs.json index 606549c8c8f..bf8da6c5f36 100644 --- a/audits/catalog/curated-repairs.json +++ b/audits/catalog/curated-repairs.json @@ -2701,18 +2701,6 @@ "method" : "testSwitchAggregationExpressionOperator", "options" : [ ], "type" : "dev.morphia.test.aggregation.expressions.TestSwitch" - }, { - "assertions" : [ "SERIALIZATION", "BEHAVIOR" ], - "categories" : [ ], - "collections" : { }, - "disabled" : false, - "disposition" : "UNCORRECTED", - "fixture" : "aggregation/expressions/tan/tangentOfValueInRadians", - "helpers" : [ "testPipeline" ], - "markers" : [ ], - "method" : "testTangentOfValueInRadians", - "options" : [ ], - "type" : "dev.morphia.test.aggregation.expressions.TestTan" }, { "assertions" : [ "SERIALIZATION", "BEHAVIOR" ], "categories" : [ ], @@ -3181,21 +3169,6 @@ "method" : "testCountAggregationStage", "options" : [ ], "type" : "dev.morphia.test.aggregation.stages.TestCount" - }, { - "assertions" : [ "SERIALIZATION", "BEHAVIOR" ], - "categories" : [ "EXTRACTION" ], - "collections" : { }, - "disabled" : false, - "disposition" : "OVERRIDDEN", - "fixture" : "aggregation/stages/densify/densifyTimeSeriesData", - "helpers" : [ "testPipeline" ], - "markers" : [ ], - "method" : "testDensifyTimeSeriesData", - "options" : [ { - "argument" : "true", - "name" : "removeIds" - } ], - "type" : "dev.morphia.test.aggregation.stages.TestDensify" }, { "assertions" : [ "SERIALIZATION", "BEHAVIOR" ], "categories" : [ ], @@ -3286,23 +3259,6 @@ "name" : "removeIds" } ], "type" : "dev.morphia.test.aggregation.stages.TestFill" - }, { - "assertions" : [ "SERIALIZATION", "BEHAVIOR" ], - "categories" : [ "MORPHIA_FORM" ], - "collections" : { - "data2.json" : "airports" - }, - "disabled" : false, - "disposition" : "OVERRIDDEN", - "fixture" : "aggregation/stages/graphLookup/acrossMultipleCollections", - "helpers" : [ "testPipeline" ], - "markers" : [ ], - "method" : "testAcrossMultipleCollections", - "options" : [ { - "argument" : "false", - "name" : "orderMatters" - } ], - "type" : "dev.morphia.test.aggregation.stages.TestGraphLookup" }, { "assertions" : [ "SERIALIZATION", "BEHAVIOR" ], "categories" : [ "FIXTURE_CURATION" ], @@ -4615,7 +4571,7 @@ "markers" : [ ], "method" : "testSelectRandomItemsFromACollection", "options" : [ { - "argument" : "new FindOptions().projection().include(\"name\", \"registered\")", + "argument" : "new FindOptions().projection().include(\"name\", \"registered\").projection().exclude(\"_id\")", "name" : "findOptions" }, { "argument" : "false", @@ -5289,23 +5245,23 @@ "repositoryRevision" : "70fde7825fcaa6f09efde4cab59b09318dfe6ee6", "schemaVersion" : 1, "summary" : { - "assertion.BEHAVIOR" : 360, + "assertion.BEHAVIOR" : 357, "assertion.CUSTOM" : 0, "assertion.DISABLED" : 1, "assertion.NONE" : 0, - "assertion.SERIALIZATION" : 386, + "assertion.SERIALIZATION" : 383, "category.DOCS_ERROR" : 26, - "category.EXTRACTION" : 28, + "category.EXTRACTION" : 27, "category.FIXTURE_CURATION" : 10, - "category.MORPHIA_FORM" : 52, + "category.MORPHIA_FORM" : 51, "category.NUMERIC_TYPE" : 17, "category.SHELL_SYNTAX" : 10, "category.UNTESTABLE" : 0, "disposition.NOT_EXECUTED" : 0, - "disposition.OVERRIDDEN" : 137, + "disposition.OVERRIDDEN" : 135, "disposition.PRESERVED_CURATED" : 0, - "disposition.UNCORRECTED" : 251, - "examples" : 388, + "disposition.UNCORRECTED" : 250, + "examples" : 385, "examples.locked" : 0, "exclusion.DEFERRED" : 1, "exclusion.ENVIRONMENT_UNAVAILABLE" : 3, @@ -5315,8 +5271,8 @@ "markers.lock" : 0, "markers.lockd" : 0, "option.findOptions" : 4, - "option.orderMatters" : 78, - "option.removeIds" : 41, + "option.orderMatters" : 77, + "option.removeIds" : 40, "option.serverVersion" : 12, "option.skipActionCheck" : 1, "option.skipDataCheck" : 27 diff --git a/audits/catalog/cutover.json b/audits/catalog/cutover.json index 4465e58c7d1..227826d27b4 100644 --- a/audits/catalog/cutover.json +++ b/audits/catalog/cutover.json @@ -1,21 +1,5 @@ { "contexts" : [ "aggregation/expressions", "aggregation/stages", "query" ], - "legacyOnly" : [ { - "check" : "SOURCE", - "detail" : "the shell normalizer cannot read the documented results (expected syntax)", - "fixture" : "aggregation/expressions/tan/tangentOfValueInRadians" - }, { - "check" : "SOURCE", - "detail" : "the shell normalizer cannot read the documented results (expected syntax)", - "fixture" : "aggregation/stages/densify/densifyTimeSeriesData" - }, { - "check" : "SOURCE", - "detail" : "the shell normalizer cannot read the documented results (expected syntax)", - "fixture" : "aggregation/stages/graphLookup/acrossMultipleCollections" - }, { - "check" : "SERIALIZATION", - "detail" : "the page's projection is {_id: 0, name: 1, registered: 1}; the test includes name and registered and drops _id with removeIds, so Morphia's projection lacks the _id exclusion", - "fixture" : "query/filters/rand/selectRandomItemsFromACollection" - } ], + "legacyOnly" : [ ], "schemaVersion" : 1 } diff --git a/audits/catalog/deleted-fixtures.json b/audits/catalog/deleted-fixtures.json index ccb2bf77ac5..d044d63097e 100644 --- a/audits/catalog/deleted-fixtures.json +++ b/audits/catalog/deleted-fixtures.json @@ -744,6 +744,17 @@ "fixture" : "aggregation/expressions/tan/tangentOfValueInDegrees", "reason" : "locked, and no documented source reproduces it: SOURCE_UNSUPPORTED expected syntax", "test" : "dev.morphia.test.aggregation.expressions.TestTan#testTangentOfValueInDegrees" + }, { + "bodySha256" : "5b1267ed95c62fdab6cc54f6f8ac4e9463b5c513fb3cb4684f32bb13aaa9ac9d", + "files" : { + "action.json" : "996a16cd8f0fc500f6c70207c16c5fe5394bc3417543d3457e47d18d6369395e", + "data.json" : "fd1f3c01af034e96548f5056994d7debe99c6ce7a330aea1e56e6caf09a423ba", + "expected.json" : "e45e98a10aad1cd7060ca3fa3d3566d774330eec741f74d7c5c134428b36372e", + "name" : "85550610332a687515dc5c999ff1738f22eb8164fdabad152f2c32cc31ca1a88" + }, + "fixture" : "aggregation/expressions/tan/tangentOfValueInRadians", + "reason" : "the page's printed results do not parse (a typo in the page, such as a missing comma or quote), so no documented result backs the fixture", + "test" : "dev.morphia.test.aggregation.expressions.TestTan#testTangentOfValueInRadians" }, { "bodySha256" : "a41457eb765f883b58f66f5df3048ef78b356728b743279ac1c7a7702cb7318a", "files" : { @@ -902,6 +913,18 @@ "fixture" : "aggregation/stages/densify/densifictionWithPartitions", "reason" : "locked, and no documented source reproduces it: RESIDUAL_DIFFERENCE action KEY_ORDER at /0/$densify/range", "test" : "dev.morphia.test.aggregation.stages.TestDensify#testDensifictionWithPartitions" + }, { + "bodySha256" : "a30db196605d546a69f0d17e0b0a646ca48fbed4ebae721b2795c8d08168aff6", + "files" : { + "action.json" : "2348c50766595c53d3d646d242869d3d5c23b9c41283814f87ecb4068cc052fb", + "data.json" : "18db83af8ad8ec5f3a608e49643b0dba82ef9a13dcd319571e8b8cb7829dae99", + "expected.json" : "cc772d102dd3d52323c98e7ea2885cee9b495a73bad284c32d96df908df7ae5c", + "lock" : "94aca22c7d8d4fe590088e718ab515314a21777f16edce24999e53b9858fbf7f", + "name" : "02802cbee4a01571e39dc003c5c2d17b7d17e1353a1c745e4077c2bdc66ad77c" + }, + "fixture" : "aggregation/stages/densify/densifyTimeSeriesData", + "reason" : "the page's printed results do not parse (a typo in the page, such as a missing comma or quote), so no documented result backs the fixture", + "test" : "dev.morphia.test.aggregation.stages.TestDensify#testDensifyTimeSeriesData" }, { "bodySha256" : "bf20a2a13bae62691f781828e8d7199b76d92ce7a9c798dd56d36ff9e79c94f6", "files" : { @@ -1005,6 +1028,19 @@ "fixture" : "aggregation/stages/geoNear/specifyWhichGeospatialIndexToUse", "reason" : "no documented page reproduces it: RESIDUAL_DIFFERENCE index.json has no documented source", "test" : "dev.morphia.test.aggregation.stages.TestGeoNear#testSpecifyWhichGeospatialIndexToUse" + }, { + "bodySha256" : "703c2dcb40ba995d98829a527eb99cc0e1c4650c115a522d170481b7940bb193", + "files" : { + "action.json" : "605bde048bff6db6a77944897b2df3024bd5c19158386dbfedf765486f47c1ee", + "data.json" : "00061634b23aeb5b13f358628171b20dd87ace338afa8b215a93425424ba9ea1", + "data2.json" : "c31732455fc49cd4428e47822663db4ee0c9116e7031a2e1da8f0f1ffa850205", + "expected.json" : "4d8f3e5295b46da09ca3cad0636c361668e6dbbe153419f294674219a9623ff5", + "lock" : "837a91236817cbc098b8d616cb3ef2e055d7ba25a14e79ec7a9e509765c910b1", + "name" : "068903a39c63f8c83b724e2fa3024427b5554c7ceb0d05c972c48097cefb5777" + }, + "fixture" : "aggregation/stages/graphLookup/acrossMultipleCollections", + "reason" : "the page's printed results do not parse (a typo in the page, such as a missing comma or quote), so no documented result backs the fixture", + "test" : "dev.morphia.test.aggregation.stages.TestGraphLookup#testAcrossMultipleCollections" }, { "bodySha256" : "fc228272ac5563a6d012197015d746c9cf56d833a2c5305c7f86b2560f116db8", "files" : { diff --git a/audits/catalog/documented-examples.json b/audits/catalog/documented-examples.json index 969cb030891..b7ab85d19d6 100644 --- a/audits/catalog/documented-examples.json +++ b/audits/catalog/documented-examples.json @@ -6207,11 +6207,23 @@ "stem" : "mainTangentOfValueInDegrees", "title" : "main :: Tangent of Value in Degrees" }, { - "blocks" : [ ], + "blocks" : [ { + "role" : "ACTION", + "sha256" : "77142b787e783ee8c05ae6136926b5f5739eb5b9c584cd0977285b1e6333d795", + "text" : "db.trigonometry.aggregate([\n {\n $addFields : {\n \"side_b\" : {\n $multiply : [\n { $tan : \"$angle_a\" },\n \"$side_a\"\n ]\n }\n }\n }\n])" + }, { + "role" : "DATA", + "sha256" : "32aea62bc2358b846c116d8494678e6c3c179959a768c6fd85113aaf6ea52b83", + "text" : "{\n \"_id\" : ObjectId(\"5c50782193f833234ba90d85\"),\n \"angle_a\" : Decimal128(\"0.9272952180016122324285124629224288\"),\n \"side_a\" : Decimal128(\"3\")\n}" + }, { + "role" : "EXPECTED", + "sha256" : "b1cec4c24b23c8ddfd3de82a2ddabd511a8959d8e49c491793911b6597c5e78b", + "text" : "{\n \"_id\" : ObjectId(\"5c50782193f833234ba90d85\"),\n \"angle_a\" : Decimal128(\"0.9272952180016122324285124629224288\"),\n \"side_a\" : Decimal128(\"3\")\n \"side_b\" : Decimal128(\"3.999999999999999999999999999999999\")\n}" + } ], "detail" : null, - "owner" : "aggregation/expressions/tan/tangentOfValueInRadians", - "status" : "OWNED", - "stem" : null, + "owner" : null, + "status" : "UNOWNED", + "stem" : "mainTangentOfValueInRadians", "title" : "main :: Tangent of Value in Radians" } ], "includes" : [ ], @@ -7574,11 +7586,23 @@ }, { "context" : "aggregation/stages", "examples" : [ { - "blocks" : [ ], + "blocks" : [ { + "role" : "ACTION", + "sha256" : "f04db7a01a8e97bf6b450b0c3940bdcbcb7d7c31f839149369613c311b3fa6f6", + "text" : "db.weather.aggregate( [\n {\n $densify: {\n field: \"timestamp\",\n range: {\n step: 1,\n unit: \"hour\",\n bounds:[ ISODate(\"2021-05-18T00:00:00.000Z\"), ISODate(\"2021-05-18T08:00:00.000Z\") ]\n }\n }\n }\n] )" + }, { + "role" : "DATA", + "sha256" : "b3415be8c72026acf1cf50ca163d7f39ee479da9656ea12e68de9d9c9953d1a9", + "text" : "db.weather.insertMany( [\n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T00:00:00.000Z\"),\n \"temp\": 12\n },\n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T04:00:00.000Z\"),\n \"temp\": 11\n },\n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T08:00:00.000Z\"),\n \"temp\": 11\n },\n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T12:00:00.000Z\"),\n \"temp\": 12\n }\n] )" + }, { + "role" : "EXPECTED", + "sha256" : "876e2bcb09f785c573f004c5f99ca084eb86c69b594b1a492d3feff8986b2a9a", + "text" : "[\n {\n _id: ObjectId(\"618c207c63056cfad0ca4309\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T00:00:00.000Z\"),\n temp: 12\n },\n { timestamp: ISODate(\"2021-05-18T01:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T02:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T03:00:00.000Z\") },\n {\n _id: ObjectId(\"618c207c63056cfad0ca430a\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T04:00:00.000Z\"),\n temp: 11\n },\n { timestamp: ISODate(\"2021-05-18T05:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T06:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T07:00:00.000Z\") },\n {\n _id: ObjectId(\"618c207c63056cfad0ca430b\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T08:00:00.000Z\"),\n temp: 11\n }\n {\n _id: ObjectId(\"618c207c63056cfad0ca430c\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T12:00:00.000Z\"),\n temp: 12\n }\n]" + } ], "detail" : null, - "owner" : "aggregation/stages/densify/densifyTimeSeriesData", - "status" : "OWNED", - "stem" : null, + "owner" : null, + "status" : "UNOWNED", + "stem" : "densifyTimeSeriesData", "title" : "Densify Time Series Data" }, { "blocks" : [ { @@ -7920,11 +7944,27 @@ "stem" : null, "title" : "Within a Single Collection" }, { - "blocks" : [ ], + "blocks" : [ { + "role" : "ACTION", + "sha256" : "2307d7043a9abff0bcb4efcb4efe26c89801cbfab9d54f1d483d0fe04ad826cc", + "text" : "db.travelers.aggregate( [\n {\n $graphLookup: {\n from: \"airports\",\n startWith: \"$nearestAirport\",\n connectFromField: \"connects\",\n connectToField: \"airport\",\n maxDepth: 2,\n depthField: \"numConnections\",\n as: \"destinations\"\n }\n }\n] )" + }, { + "role" : "DATA", + "sha256" : "515ac57d4c6bc472d31aca191bdefc9796ec1db572bcd3eb90213e63ba3682f3", + "text" : "db.airports.insertMany( [\n { _id: 0, airport: \"JFK\", connects: [ \"BOS\", \"ORD\" ] },\n { _id: 1, airport: \"BOS\", connects: [ \"JFK\", \"PWM\" ] },\n { _id: 2, airport: \"ORD\", connects: [ \"JFK\" ] },\n { _id: 3, airport: \"PWM\", connects: [ \"BOS\", \"LHR\" ] },\n { _id: 4, airport: \"LHR\", connects: [ \"PWM\" ] }\n] )" + }, { + "role" : "DATA", + "sha256" : "315799a351d0730be7d528103983e43515d196c72d7538eb718c52b568870af4", + "text" : "db.travelers.insertMany( [\n { _id: 1, name: \"Dev\", nearestAirport: \"JFK\" },\n { _id: 2, name: \"Eliot\", nearestAirport: \"JFK\" },\n { _id: 3, name: \"Jeff\", nearestAirport: \"BOS\" }\n] )" + }, { + "role" : "EXPECTED", + "sha256" : "bba1f4e6a15396c2fabc96ecbf4159bba529360957a0513d002e4dd62750cac7", + "text" : "[\n {\n _id: 1,\n name: 'Dev',\n nearestAirport: 'JFK',\n destinations: [\n {\n _id: 0,\n airport: 'JFK',\n connects: [ 'BOS', 'ORD' ],\n numConnections: Long('0')\n },\n {\n _id: 1,\n airport: 'BOS',\n connects: [ 'JFK', 'PWM' ],\n numConnections: Long('1')\n },\n {\n _id: 3,\n airport: 'PWM',\n connects: [ 'BOS', 'LHR' ],\n numConnections: Long('2')\n },\n {\n _id: 2,\n airport: 'ORD',\n connects: [ 'JFK' ],\n numConnections: Long('1')\n }\n ]\n },\n {\n _id: 2,\n name: 'Eliot',\n nearestAirport: 'JFK',\n destinations: [\n {\n _id: 0,\n airport: 'JFK',\n connects: [ 'BOS', 'ORD' ],\n numConnections: Long('0')\n },\n {\n _id: 1,\n airport: 'BOS',\n connects: [ 'JFK', 'PWM' ],\n numConnections: Long('1')\n },\n {\n _id: 3,\n airport: 'PWM',\n connects: [ 'BOS', 'LHR' ],\n numConnections: Long('2')\n },\n {\n _id: 2,\n airport: 'ORD',\n connects: [ 'JFK' ],\n numConnections: Long('1')\n }\n ]\n },\n {\n _id: 3,\n name: 'Jeff',\n nearestAirport: 'BOS',\n destinations: [\n {\n _id: 0,\n airport: 'JFK',\n connects: [ 'BOS', 'ORD' ],\n numConnections: Long('1')\n },\n {\n _id: 1,\n airport: 'BOS',\n connects: [ 'JFK', 'PWM' ],\n numConnections: Long('0')\n },\n {\n _id: 4,\n airport: 'LHR',\n connects: [ 'PWM' ],\n numConnections: Long('2')\n },\n {\n _id: 3,\n airport: 'PWM',\n connects: [ 'BOS', 'LHR' ],\n numConnections: Long('1')\n },\n {\n _id: 2,\n airport: 'ORD',\n connects: [ 'JFK' ],\n numConnections: Long('2')\n }\n ]\n }\n]" + } ], "detail" : null, - "owner" : "aggregation/stages/graphLookup/acrossMultipleCollections", - "status" : "OWNED", - "stem" : null, + "owner" : null, + "status" : "UNOWNED", + "stem" : "acrossMultipleCollections", "title" : "Across Multiple Collections" }, { "blocks" : [ ], @@ -13918,9 +13958,9 @@ "sourceRepository" : "mongodb/docs", "summary" : { "examples.ambiguous" : 0, - "examples.owned" : 323, + "examples.owned" : 320, "examples.unnamed" : 0, - "examples.unowned" : 259, + "examples.unowned" : 262, "pages" : 297, "pages.skipped" : 3, "reviews.stale" : 0 diff --git a/audits/catalog/fixture-migration.json b/audits/catalog/fixture-migration.json index 101b53e2775..8ff0f2541c1 100644 --- a/audits/catalog/fixture-migration.json +++ b/audits/catalog/fixture-migration.json @@ -22760,6 +22760,79 @@ "scenario" : "core/src/test/resources/dev/morphia/test/query/filters/polygon/polygonQueryPredicateOperator/scenario.json", "scenarioSha256" : "bfd3628c1fe644cb1a33c89f2fa73bceca2fcb64d4792c3c04fe8a4fb94aef75", "test" : "dev.morphia.test.query.filters.TestPolygon#testPolygonQueryPredicateOperator" + }, { + "addedRules" : { + "reason" : "Morphia writes a projection's inclusions before its exclusions, so _id comes last; its position does not change the output", + "rules" : [ "PROJECT_ID_FIRST" ] + }, + "bodyEdit" : { + "fromSha256" : "e7ac647ead7238ce925e406268440a1abba4e361d58d4873f88bf218c230b294", + "reason" : "projects _id away as the page does ({ _id: 0, name: 1, registered: 1 }), so the runner compares Morphia's projection with the page's" + }, + "files" : { + "action.json" : "51ff919175dbfc7b25f4a0f62bcc734ec6c740b6c735eb81ffbdfd36062737a7", + "data.json" : "d2d21026bcbe7ad8640307c52a6ce69f2d3c8c73e49b1520e3617c613c55258b", + "expected.json" : "bab7cae25ff4b8329665a7ba6ca92323bcaa3b0f9e95b127ac47cd0ec13bf705", + "name" : "6f4c54ab1ba31afac42df1ced6bdd572f9cb33575a5beacd1a0acddecd265312" + }, + "fixture" : "query/filters/rand/selectRandomItemsFromACollection", + "kind" : "CONVERTED", + "legacyBody" : "{\n ActionTestOptions options = new ActionTestOptions().orderMatters(false).removeIds(true).skipDataCheck(true)\n .findOptions(new FindOptions().projection().include(\"name\", \"registered\").projection().exclude(\"_id\"));\n testQuery(options, (query) -> query.filter(eq(\"district\", 3), expr(lt(0.5, rand()))));\n }", + "legacyBodySha256" : "310ddadaac7f63d274f5a936b2875b86b70e8019024929cedee5e943ff634f25", + "legacyMethod" : "testSelectRandomItemsFromACollection", + "legacyType" : "dev.morphia.test.query.filters.TestRand", + "options" : [ { + "argument" : "new FindOptions().projection().include(\"name\", \"registered\").projection().exclude(\"_id\")", + "name" : "findOptions" + }, { + "argument" : "true", + "name" : "removeIds" + }, { + "argument" : "true", + "name" : "skipDataCheck" + } ], + "ordered" : false, + "override" : { + "blocks" : [ { + "role" : "ACTION", + "sha256" : "51ff919175dbfc7b25f4a0f62bcc734ec6c740b6c735eb81ffbdfd36062737a7", + "text" : "db.voters.find(\n { district: 3,\n $expr: { $lt: [0.5, {$rand: {} } ] }\n },\n { _id: 0, name: 1, registered: 1 }\n)" + }, { + "role" : "DATA", + "sha256" : "1c9da9ed37f454d85f9c08bddd91049ff8f370ef2d5d2bcd08a432054fdc55d6", + "text" : "db.voters.insertMany(\n [\n { name: \"Archibald\", voterId: 4321, district: 3, registered: true },\n { name: \"Beckham\", voterId: 4331, district: 3, registered: true },\n { name: \"Carolin\", voterId: 5321, district: 4, registered: true },\n { name: \"Debarge\", voterId: 4343, district: 3, registered: false },\n { name: \"Eckhard\", voterId: 4161, district: 3, registered: false },\n { name: \"Faberge\", voterId: 4300, district: 1, registered: true },\n { name: \"Grimwald\", voterId: 4111, district: 3, registered: true },\n { name: \"Humphrey\", voterId: 2021, district: 3, registered: true },\n { name: \"Idelfon\", voterId: 1021, district: 4, registered: true },\n { name: \"Justo\", voterId: 9891, district: 3, registered: false }\n ]\n)" + }, { + "role" : "EXPECTED", + "sha256" : "bab7cae25ff4b8329665a7ba6ca92323bcaa3b0f9e95b127ac47cd0ec13bf705", + "text" : "{ \"name\" : \"Beckham\", \"registered\" : true }\n{ \"name\" : \"Eckhard\", \"registered\" : false }\n{ \"name\" : \"Grimwald\", \"registered\" : true }\n{ \"name\" : \"Humphrey\", \"registered\" : true }" + } ], + "collections" : { }, + "corrections" : [ ], + "example" : "Select Random Items From a Collection", + "fixture" : "query/filters/rand/selectRandomItemsFromACollection", + "fixtureFiles" : { + "action.json" : "51ff919175dbfc7b25f4a0f62bcc734ec6c740b6c735eb81ffbdfd36062737a7", + "data.json" : "d2d21026bcbe7ad8640307c52a6ce69f2d3c8c73e49b1520e3617c613c55258b", + "expected.json" : "bab7cae25ff4b8329665a7ba6ca92323bcaa3b0f9e95b127ac47cd0ec13bf705", + "name" : "6f4c54ab1ba31afac42df1ced6bdd572f9cb33575a5beacd1a0acddecd265312" + }, + "includes" : [ ], + "origin" : "24f35df159da5bd0da6a8f822280067e138aa632", + "pageBlob" : "536ca45ea56b6ae5c998d9a4e7d2b452d9f10e0b", + "retiredLock" : null, + "retypes" : [ ], + "rules" : [ ], + "shape" : "FIND", + "source" : { + "commit" : "65d54987f7f4008507de4346d3c4c5ca37b8ec21", + "path" : "source/reference/operator/query/rand.txt", + "relation" : "AT_ORIGIN" + }, + "unexpandedIncludes" : [ ] + }, + "scenario" : "core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/scenario.json", + "scenarioSha256" : "5a272c76a0edc50fe27e476ae3420fc19b391c103fa5d5f2907a04443570657b", + "test" : "dev.morphia.test.query.filters.TestRand#testSelectRandomItemsFromACollection" }, { "bodyEdit" : null, "files" : { @@ -23608,6 +23681,86 @@ "scenario" : "core/src/test/resources/dev/morphia/test/query/filters/text/textWithAnExactString/scenario.json", "scenarioSha256" : "eb71dbdc9a7918a19a15f805128266ed7383946a1a18134634a8dee607563b60", "test" : "dev.morphia.test.query.filters.TestText#testTextWithAnExactString" + }, { + "bodyEdit" : null, + "files" : { + "action.json" : "0efc4ec67fb9ce67ef1ad052ac14d884bd742ea14c60c9528b72a54d112a150a", + "data.json" : "20b8aea83fa0ddd88b6e760e8a6044e9636433541ba9a1b8f4b1f9874e4c125a", + "expected.json" : "d4d816ab10899b6ca1b11c8177ec041c1d8c5e40a63c3e040d9032b62e67b093", + "lock" : "a1f0944e912ca102f402d78239f988cbf2217d038a09a9b2642a717c946bdce0", + "name" : "7504ab1f4910de0a5a3663babc806b05bfbb68e565964ebe9579cf30eb9d44d7" + }, + "fixture" : "query/filters/type/queryingByMultipleDataTypes", + "kind" : "CONVERTED", + "legacyBody" : "{\n testQuery((query) -> query.filter(type(\"classAverage\", Type.STRING, Type.DOUBLE)));\n }", + "legacyBodySha256" : "be413874537511bba7c01a40e7b5bcb41246a031d52bd194566f657e853fbcf9", + "legacyMethod" : "testQueryingByMultipleDataTypes", + "legacyType" : "dev.morphia.test.query.filters.TestType", + "options" : [ ], + "ordered" : true, + "override" : { + "blocks" : [ { + "role" : "ACTION", + "sha256" : "abed3ccbe9e0eece268657d70d2682c3fbbad8cac7bba06f6884a1667f7cceab", + "text" : "db.grades.find( { classAverage : { $type : [ 2 , 1 ] } } );\ndb.grades.find( { classAverage : { $type : [ \"string\" , \"double\" ] } } );" + }, { + "role" : "DATA", + "sha256" : "d1f159ca42d8939f590ba3bcfc3b202f8cd663b89b3057ca2f058ebe4c00d7a2", + "text" : "db.grades.insertMany( [\n { _id : 1, name : \"Alice King\" , classAverage : 87.333333333333333 },\n { _id : 2, name : \"Bob Jenkins\", classAverage : \"83.52\" },\n { _id : 3, name : \"Cathy Hart\", classAverage: \"94.06\" },\n { _id : 4, name : \"Drew Williams\" , classAverage : NumberInt(\"93\") }\n] )" + }, { + "role" : "EXPECTED", + "sha256" : "8ce91c91d210a4003bbdf1dbe35227d561cd5fd80f46d7aee72c6d44ac7ad0fd", + "text" : "{ _id : 1, name : \"Alice King\", classAverage : 87.33333333333333 }\n{ _id : 2, name : \"Bob Jenkins\", classAverage : \"83.52\" }\n{ _id : 3, name : \"Cathy Hart\", classAverage : \"94.06\" } " + } ], + "collections" : { }, + "corrections" : [ ], + "example" : "Querying by Multiple Data Types", + "fixture" : "query/filters/type/queryingByMultipleDataTypes", + "fixtureFiles" : { + "action.json" : "0efc4ec67fb9ce67ef1ad052ac14d884bd742ea14c60c9528b72a54d112a150a", + "data.json" : "20b8aea83fa0ddd88b6e760e8a6044e9636433541ba9a1b8f4b1f9874e4c125a", + "expected.json" : "d4d816ab10899b6ca1b11c8177ec041c1d8c5e40a63c3e040d9032b62e67b093", + "name" : "7504ab1f4910de0a5a3663babc806b05bfbb68e565964ebe9579cf30eb9d44d7" + }, + "includes" : [ { + "blob" : "a140ad76120c4e6b1b54a9596dddb4c5d1dcb6fa", + "path" : "source/includes/fact-compatibility.rst" + }, { + "blob" : "af0e90475267dcf0a4b56e11aae76eeee3805ee4", + "path" : "source/includes/fact-environments.rst" + }, { + "blob" : "b770b45bc50f47b7b5d8cd771754c17a113b364f", + "path" : "source/includes/fact-environments-atlas-only.rst" + }, { + "blob" : "a7fa92b7a8083b9a17700e67517a1831f359c476", + "path" : "source/includes/fact-environments-onprem-only.rst" + }, { + "blob" : "a5cdd66b913b1f650b648124247c19889cbc6f59", + "path" : "source/includes/fact-bson-types.rst" + }, { + "blob" : "4e2e022eb95865da7e7a6bab33d940ac804f8810", + "path" : "source/includes/extracts-4.2-changes.yaml" + } ], + "origin" : "f5efa7c2b14d22ec139f3ea5a0e37bca1aefa874", + "pageBlob" : "0902d6a741899af1732131889743c75df2d9cc6e", + "retiredLock" : { + "name" : "lock", + "sha256" : "a1f0944e912ca102f402d78239f988cbf2217d038a09a9b2642a717c946bdce0", + "text" : "the docs had two actions showing the two forms. picked the form morphia uses." + }, + "retypes" : [ ], + "rules" : [ "ALTERNATIVE_COMMANDS" ], + "shape" : "FIND", + "source" : { + "commit" : "4431b1043d025a36ca3b64c17b3398de606ec6e8", + "path" : "source/reference/operator/query/type.txt", + "relation" : "AT_ORIGIN" + }, + "unexpandedIncludes" : [ ] + }, + "scenario" : "core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/scenario.json", + "scenarioSha256" : "79b96d4085bf99c0cb17ba929fe8b772d939d521a4666604e3af9d113275f6da", + "test" : "dev.morphia.test.query.filters.TestType#testQueryingByMultipleDataTypes" }, { "bodyEdit" : null, "files" : { diff --git a/audits/catalog/form-migration.json b/audits/catalog/form-migration.json index b00fe87b0ca..53c1545051e 100644 --- a/audits/catalog/form-migration.json +++ b/audits/catalog/form-migration.json @@ -1,171 +1,5 @@ { - "overrides" : [ { - "blocks" : [ { - "role" : "ACTION", - "sha256" : "f4d68dd8cdbf77d323571973710fe8085111e5956b009ddb032e4a3f44ac8488", - "text" : "db.weather.aggregate( [\n {\n $densify: {\n field: \"timestamp\",\n range: {\n step: 1, \n unit: \"hour\",\n bounds:[ ISODate(\"2021-05-18T00:00:00.000Z\"), ISODate(\"2021-05-18T08:00:00.000Z\") ]\n }\n }\n }\n] )" - }, { - "role" : "DATA", - "sha256" : "de44c24ba863ff1e699eea81f99327a6f06ff7940a0d58848900e0ca3e05a959", - "text" : "db.weather.insertMany( [\n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T00:00:00.000Z\"),\n \"temp\": 12\n }, \n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T04:00:00.000Z\"),\n \"temp\": 11\n }, \n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T08:00:00.000Z\"),\n \"temp\": 11\n }, \n {\n \"metadata\": { \"sensorId\": 5578, \"type\": \"temperature\" },\n \"timestamp\": ISODate(\"2021-05-18T12:00:00.000Z\"),\n \"temp\": 12\n }\n] )" - }, { - "role" : "EXPECTED", - "sha256" : "3455cd890c72f1eece8ea9b885af515fe8e5ee12ba60ece55135210724424d33", - "text" : "[\n {\n _id: ObjectId(\"618c207c63056cfad0ca4309\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T00:00:00.000Z\"),\n temp: 12\n },\n { timestamp: ISODate(\"2021-05-18T01:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T02:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T03:00:00.000Z\") },\n {\n _id: ObjectId(\"618c207c63056cfad0ca430a\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T04:00:00.000Z\"),\n temp: 11\n },\n { timestamp: ISODate(\"2021-05-18T05:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T06:00:00.000Z\") },\n { timestamp: ISODate(\"2021-05-18T07:00:00.000Z\") },\n {\n _id: ObjectId(\"618c207c63056cfad0ca430b\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T08:00:00.000Z\"),\n temp: 11\n }\n {\n _id: ObjectId(\"618c207c63056cfad0ca430c\"),\n metadata: { sensorId: 5578, type: 'temperature' },\n timestamp: ISODate(\"2021-05-18T12:00:00.000Z\"),\n temp: 12\n }\n]" - } ], - "collections" : { }, - "corrections" : [ ], - "example" : "Densify Time Series Data", - "fixture" : "aggregation/stages/densify/densifyTimeSeriesData", - "fixtureFiles" : { - "action.json" : "2348c50766595c53d3d646d242869d3d5c23b9c41283814f87ecb4068cc052fb", - "data.json" : "18db83af8ad8ec5f3a608e49643b0dba82ef9a13dcd319571e8b8cb7829dae99", - "expected.json" : "cc772d102dd3d52323c98e7ea2885cee9b495a73bad284c32d96df908df7ae5c", - "name" : "02802cbee4a01571e39dc003c5c2d17b7d17e1353a1c745e4077c2bdc66ad77c" - }, - "includes" : [ { - "blob" : "324ff3f0609ab2cf2413bbb59ea90d6a5299bdae", - "path" : "source/includes/fact-densify-description.rst" - }, { - "blob" : "5e6b70f902bb252f245d63ebe08566767f1553ff", - "path" : "source/includes/use-dot-notation.rst" - }, { - "blob" : "a5cfb5928c49a16fe608858a55943bd0a9495e67", - "path" : "source/includes/fact-densify-image-explanation.rst" - } ], - "origin" : "7ad9ac5e4d31c5035284090ab13521e17467015f", - "pageBlob" : "96c46909fd98852afecf4c0591ba8ebeeff49beb", - "retiredLock" : { - "name" : "lock", - "sha256" : "94aca22c7d8d4fe590088e718ab515314a21777f16edce24999e53b9858fbf7f", - "text" : "wrong name from parser" - }, - "retypes" : [ ], - "rules" : [ ], - "shape" : "PIPELINE", - "source" : { - "commit" : "5da30db6b468d0ade6a2aefe795985d5b756aa16", - "path" : "source/reference/operator/aggregation/densify.txt", - "relation" : "AT_ORIGIN" - }, - "unexpandedIncludes" : [ ] - }, { - "blocks" : [ { - "role" : "ACTION", - "sha256" : "2307d7043a9abff0bcb4efcb4efe26c89801cbfab9d54f1d483d0fe04ad826cc", - "text" : "db.travelers.aggregate( [\n {\n $graphLookup: {\n from: \"airports\",\n startWith: \"$nearestAirport\",\n connectFromField: \"connects\",\n connectToField: \"airport\",\n maxDepth: 2,\n depthField: \"numConnections\",\n as: \"destinations\"\n }\n }\n] )" - }, { - "role" : "DATA", - "sha256" : "9e65b5237a8a6b4f089a95db77210ebcd7002a8bdad987aa7a3318cf6286e226", - "text" : "db.airports.insertMany( [\n { \"_id\" : 0, \"airport\" : \"JFK\", \"connects\" : [ \"BOS\", \"ORD\" ] },\n { \"_id\" : 1, \"airport\" : \"BOS\", \"connects\" : [ \"JFK\", \"PWM\" ] },\n { \"_id\" : 2, \"airport\" : \"ORD\", \"connects\" : [ \"JFK\" ] },\n { \"_id\" : 3, \"airport\" : \"PWM\", \"connects\" : [ \"BOS\", \"LHR\" ] },\n { \"_id\" : 4, \"airport\" : \"LHR\", \"connects\" : [ \"PWM\" ] }\n] )" - }, { - "role" : "DATA", - "sha256" : "3aa8e45153559c0739bedc0b185c162c7c6537334e9ae99f3948aad905ac2828", - "text" : "db.travelers.insertMany( [\n { \"_id\" : 1, \"name\" : \"Dev\", \"nearestAirport\" : \"JFK\" },\n { \"_id\" : 2, \"name\" : \"Eliot\", \"nearestAirport\" : \"JFK\" },\n { \"_id\" : 3, \"name\" : \"Jeff\", \"nearestAirport\" : \"BOS\" }\n] )" - }, { - "role" : "EXPECTED", - "sha256" : "8edc5a26ee75d1eca3d8e4ab7d5e6655d9072cd1c3c3120fd6e8a07d1ff1c1ec", - "text" : "{\n \"_id\" : 1,\n \"name\" : \"Dev\",\n \"nearestAirport\" : \"JFK\",\n \"destinations\" : [\n { \"_id\" : 3,\n \"airport\" : \"PWM\",\n \"connects\" : [ \"BOS\", \"LHR\" ],\n \"numConnections\" : NumberLong(2) },\n { \"_id\" : 2,\n \"airport\" : \"ORD\",\n \"connects\" : [ \"JFK\" ],\n \"numConnections\" : NumberLong(1) },\n { \"_id\" : 1,\n \"airport\" : \"BOS\",\n \"connects\" : [ \"JFK\", \"PWM\" ],\n \"numConnections\" : NumberLong(1) },\n { \"_id\" : 0,\n \"airport\" : \"JFK\",\n \"connects\" : [ \"BOS\", \"ORD\" ],\n \"numConnections\" : NumberLong(0) }\n ]\n}\n{\n \"_id\" : 2,\n \"name\" : \"Eliot\",\n \"nearestAirport\" : \"JFK\",\n \"destinations\" : [\n { \"_id\" : 3,\n \"airport\" : \"PWM\",\n \"connects\" : [ \"BOS\", \"LHR\" ],\n \"numConnections\" : NumberLong(2) },\n { \"_id\" : 2,\n \"airport\" : \"ORD\",\n \"connects\" : [ \"JFK\" ],\n \"numConnections\" : NumberLong(1) },\n { \"_id\" : 1,\n \"airport\" : \"BOS\",\n \"connects\" : [ \"JFK\", \"PWM\" ],\n \"numConnections\" : NumberLong(1) },\n { \"_id\" : 0,\n \"airport\" : \"JFK\",\n \"connects\" : [ \"BOS\", \"ORD\" ],\n \"numConnections\" : NumberLong(0) } ]\n}\n{\n \"_id\" : 3,\n \"name\" : \"Jeff\",\n \"nearestAirport\" : \"BOS\",\n \"destinations\" : [\n { \"_id\" : 2,\n \"airport\" : \"ORD\",\n \"connects\" : [ \"JFK\" ],\n \"numConnections\" : NumberLong(2) },\n { \"_id\" : 3,\n \"airport\" : \"PWM\",\n \"connects\" : [ \"BOS\", \"LHR\" ],\n \"numConnections\" : NumberLong(1) },\n { \"_id\" : 4,\n \"airport\" : \"LHR\",\n \"connects\" : [ \"PWM\" ],\n \"numConnections\" : NumberLong(2) },\n { \"_id\" : 0,\n \"airport\" : \"JFK\",\n \"connects\" : [ \"BOS\", \"ORD\" ],\n \"numConnections\" : NumberLong(1) },\n { \"_id\" : 1,\n \"airport\" : \"BOS\",\n \"connects\" : [ \"JFK\", \"PWM\" ],\n \"numConnections\" : NumberLong(0) }\n ]\n}" - } ], - "collections" : { - "data2.json" : "airports" - }, - "corrections" : [ ], - "example" : "Across Multiple Collections", - "fixture" : "aggregation/stages/graphLookup/acrossMultipleCollections", - "fixtureFiles" : { - "action.json" : "605bde048bff6db6a77944897b2df3024bd5c19158386dbfedf765486f47c1ee", - "data.json" : "00061634b23aeb5b13f358628171b20dd87ace338afa8b215a93425424ba9ea1", - "data2.json" : "c31732455fc49cd4428e47822663db4ee0c9116e7031a2e1da8f0f1ffa850205", - "expected.json" : "4d8f3e5295b46da09ca3cad0636c361668e6dbbe153419f294674219a9623ff5", - "name" : "068903a39c63f8c83b724e2fa3024427b5554c7ceb0d05c972c48097cefb5777" - }, - "includes" : [ { - "blob" : "88a019ea44d91726953d31d21e664e1333190efd", - "path" : "source/includes/graphLookup-sharded-coll-transaction-note.rst" - }, { - "blob" : "6beb75178564cf0b943050f7e6ef2d96165ce728", - "path" : "source/includes/fact-graphlookup-memory-restrictions.rst" - }, { - "blob" : "621353fe8533a76f297866363e194e3e42cf03a0", - "path" : "source/includes/extracts-views.yaml" - } ], - "origin" : "7ad9ac5e4d31c5035284090ab13521e17467015f", - "pageBlob" : "d00d3c58699ec5ad0505fdcab3026e35f522ce87", - "retiredLock" : { - "name" : "lock", - "sha256" : "837a91236817cbc098b8d616cb3ef2e055d7ba25a14e79ec7a9e509765c910b1", - "text" : "updated pipeline order\n" - }, - "retypes" : [ ], - "rules" : [ "NAMED_ARGUMENTS" ], - "shape" : "PIPELINE", - "source" : { - "commit" : "fbff8bd22e055259d67b394c854f128340571b1f", - "path" : "source/reference/operator/aggregation/graphLookup.txt", - "relation" : "AT_ORIGIN" - }, - "unexpandedIncludes" : [ ] - }, { - "blocks" : [ { - "role" : "ACTION", - "sha256" : "abed3ccbe9e0eece268657d70d2682c3fbbad8cac7bba06f6884a1667f7cceab", - "text" : "db.grades.find( { classAverage : { $type : [ 2 , 1 ] } } );\ndb.grades.find( { classAverage : { $type : [ \"string\" , \"double\" ] } } );" - }, { - "role" : "DATA", - "sha256" : "d1f159ca42d8939f590ba3bcfc3b202f8cd663b89b3057ca2f058ebe4c00d7a2", - "text" : "db.grades.insertMany( [\n { _id : 1, name : \"Alice King\" , classAverage : 87.333333333333333 },\n { _id : 2, name : \"Bob Jenkins\", classAverage : \"83.52\" },\n { _id : 3, name : \"Cathy Hart\", classAverage: \"94.06\" },\n { _id : 4, name : \"Drew Williams\" , classAverage : NumberInt(\"93\") }\n] )" - }, { - "role" : "EXPECTED", - "sha256" : "8ce91c91d210a4003bbdf1dbe35227d561cd5fd80f46d7aee72c6d44ac7ad0fd", - "text" : "{ _id : 1, name : \"Alice King\", classAverage : 87.33333333333333 }\n{ _id : 2, name : \"Bob Jenkins\", classAverage : \"83.52\" }\n{ _id : 3, name : \"Cathy Hart\", classAverage : \"94.06\" } " - } ], - "collections" : { }, - "corrections" : [ ], - "example" : "Querying by Multiple Data Types", - "fixture" : "query/filters/type/queryingByMultipleDataTypes", - "fixtureFiles" : { - "action.json" : "0efc4ec67fb9ce67ef1ad052ac14d884bd742ea14c60c9528b72a54d112a150a", - "data.json" : "20b8aea83fa0ddd88b6e760e8a6044e9636433541ba9a1b8f4b1f9874e4c125a", - "expected.json" : "d4d816ab10899b6ca1b11c8177ec041c1d8c5e40a63c3e040d9032b62e67b093", - "name" : "7504ab1f4910de0a5a3663babc806b05bfbb68e565964ebe9579cf30eb9d44d7" - }, - "includes" : [ { - "blob" : "a140ad76120c4e6b1b54a9596dddb4c5d1dcb6fa", - "path" : "source/includes/fact-compatibility.rst" - }, { - "blob" : "af0e90475267dcf0a4b56e11aae76eeee3805ee4", - "path" : "source/includes/fact-environments.rst" - }, { - "blob" : "b770b45bc50f47b7b5d8cd771754c17a113b364f", - "path" : "source/includes/fact-environments-atlas-only.rst" - }, { - "blob" : "a7fa92b7a8083b9a17700e67517a1831f359c476", - "path" : "source/includes/fact-environments-onprem-only.rst" - }, { - "blob" : "a5cdd66b913b1f650b648124247c19889cbc6f59", - "path" : "source/includes/fact-bson-types.rst" - }, { - "blob" : "4e2e022eb95865da7e7a6bab33d940ac804f8810", - "path" : "source/includes/extracts-4.2-changes.yaml" - } ], - "origin" : "f5efa7c2b14d22ec139f3ea5a0e37bca1aefa874", - "pageBlob" : "0902d6a741899af1732131889743c75df2d9cc6e", - "retiredLock" : { - "name" : "lock", - "sha256" : "a1f0944e912ca102f402d78239f988cbf2217d038a09a9b2642a717c946bdce0", - "text" : "the docs had two actions showing the two forms. picked the form morphia uses." - }, - "retypes" : [ ], - "rules" : [ "ALTERNATIVE_COMMANDS" ], - "shape" : "FIND", - "source" : { - "commit" : "4431b1043d025a36ca3b64c17b3398de606ec6e8", - "path" : "source/reference/operator/query/type.txt", - "relation" : "AT_ORIGIN" - }, - "unexpandedIncludes" : [ ] - } ], + "overrides" : [ ], "repositoryRevision" : "70fde7825fcaa6f09efde4cab59b09318dfe6ee6", "rules" : [ { "description" : "$cond: {if: a, then: b, else: c} and $cond: [a, b, c] are the same expression; the array form is canonical.", @@ -207,15 +41,15 @@ "gap.REJECTED" : 0, "gap.RESIDUAL_DIFFERENCE" : 0, "gap.SOURCE_UNSUPPORTED" : 0, - "overrides" : 3, + "overrides" : 0, "overrides.corrected" : 0, - "overrides.exact" : 1, + "overrides.exact" : 0, "overrides.retyped" : 0, - "rule.ALTERNATIVE_COMMANDS" : 1, + "rule.ALTERNATIVE_COMMANDS" : 0, "rule.COND_ARRAY" : 0, "rule.EQ_SHORTHAND" : 0, "rule.FIELD_OPERATORS_AND" : 0, - "rule.NAMED_ARGUMENTS" : 1, + "rule.NAMED_ARGUMENTS" : 0, "rule.PROJECTION_FLAGS" : 0, "rule.PROJECT_ID_FIRST" : 0, "rule.REGEX_FORM" : 0, diff --git a/audits/catalog/form-review.json b/audits/catalog/form-review.json index 121505589ae..1ddade7c5b5 100644 --- a/audits/catalog/form-review.json +++ b/audits/catalog/form-review.json @@ -1,89 +1,5 @@ { - "declarations" : [ { - "corrections" : [ ], - "fixture" : "aggregation/stages/densify/densifyTimeSeriesData", - "includes" : [ { - "blob" : "324ff3f0609ab2cf2413bbb59ea90d6a5299bdae", - "path" : "source/includes/fact-densify-description.rst" - }, { - "blob" : "5e6b70f902bb252f245d63ebe08566767f1553ff", - "path" : "source/includes/use-dot-notation.rst" - }, { - "blob" : "a5cfb5928c49a16fe608858a55943bd0a9495e67", - "path" : "source/includes/fact-densify-image-explanation.rst" - } ], - "justification" : null, - "lock" : "wrong name from parser", - "marker" : "lock", - "origin" : "7ad9ac5e4d31c5035284090ab13521e17467015f", - "pageBlob" : "96c46909fd98852afecf4c0591ba8ebeeff49beb", - "retypes" : [ ], - "rules" : [ ], - "source" : { - "commit" : "5da30db6b468d0ade6a2aefe795985d5b756aa16", - "path" : "source/reference/operator/aggregation/densify.txt", - "relation" : "AT_ORIGIN" - } - }, { - "corrections" : [ ], - "fixture" : "aggregation/stages/graphLookup/acrossMultipleCollections", - "includes" : [ { - "blob" : "88a019ea44d91726953d31d21e664e1333190efd", - "path" : "source/includes/graphLookup-sharded-coll-transaction-note.rst" - }, { - "blob" : "6beb75178564cf0b943050f7e6ef2d96165ce728", - "path" : "source/includes/fact-graphlookup-memory-restrictions.rst" - }, { - "blob" : "621353fe8533a76f297866363e194e3e42cf03a0", - "path" : "source/includes/extracts-views.yaml" - } ], - "justification" : null, - "lock" : "updated pipeline order\n", - "marker" : "lock", - "origin" : "7ad9ac5e4d31c5035284090ab13521e17467015f", - "pageBlob" : "d00d3c58699ec5ad0505fdcab3026e35f522ce87", - "retypes" : [ ], - "rules" : [ "NAMED_ARGUMENTS" ], - "source" : { - "commit" : "fbff8bd22e055259d67b394c854f128340571b1f", - "path" : "source/reference/operator/aggregation/graphLookup.txt", - "relation" : "AT_ORIGIN" - } - }, { - "corrections" : [ ], - "fixture" : "query/filters/type/queryingByMultipleDataTypes", - "includes" : [ { - "blob" : "a140ad76120c4e6b1b54a9596dddb4c5d1dcb6fa", - "path" : "source/includes/fact-compatibility.rst" - }, { - "blob" : "af0e90475267dcf0a4b56e11aae76eeee3805ee4", - "path" : "source/includes/fact-environments.rst" - }, { - "blob" : "b770b45bc50f47b7b5d8cd771754c17a113b364f", - "path" : "source/includes/fact-environments-atlas-only.rst" - }, { - "blob" : "a7fa92b7a8083b9a17700e67517a1831f359c476", - "path" : "source/includes/fact-environments-onprem-only.rst" - }, { - "blob" : "a5cdd66b913b1f650b648124247c19889cbc6f59", - "path" : "source/includes/fact-bson-types.rst" - }, { - "blob" : "4e2e022eb95865da7e7a6bab33d940ac804f8810", - "path" : "source/includes/extracts-4.2-changes.yaml" - } ], - "justification" : "The page runs db.grades.find({classAverage: {$type: [2, 1]}}) and db.grades.find({classAverage: {$type: [\"string\", \"double\"]}}) with one shared result; BSON type numbers 2 and 1 are the aliases \"string\" and \"double\".", - "lock" : "the docs had two actions showing the two forms. picked the form morphia uses.", - "marker" : "lock", - "origin" : "f5efa7c2b14d22ec139f3ea5a0e37bca1aefa874", - "pageBlob" : "0902d6a741899af1732131889743c75df2d9cc6e", - "retypes" : [ ], - "rules" : [ "ALTERNATIVE_COMMANDS" ], - "source" : { - "commit" : "4431b1043d025a36ca3b64c17b3398de606ec6e8", - "path" : "source/reference/operator/query/type.txt", - "relation" : "AT_ORIGIN" - } - } ], + "declarations" : [ ], "migrated" : [ { "corrections" : [ ], "fixture" : "aggregation/expressions/acosh/inverseHyperbolicCosineInDegrees", @@ -3526,6 +3442,40 @@ "path" : "source/reference/operator/query/regex.txt", "relation" : "AT_ORIGIN" } + }, { + "corrections" : [ ], + "fixture" : "query/filters/type/queryingByMultipleDataTypes", + "includes" : [ { + "blob" : "a140ad76120c4e6b1b54a9596dddb4c5d1dcb6fa", + "path" : "source/includes/fact-compatibility.rst" + }, { + "blob" : "af0e90475267dcf0a4b56e11aae76eeee3805ee4", + "path" : "source/includes/fact-environments.rst" + }, { + "blob" : "b770b45bc50f47b7b5d8cd771754c17a113b364f", + "path" : "source/includes/fact-environments-atlas-only.rst" + }, { + "blob" : "a7fa92b7a8083b9a17700e67517a1831f359c476", + "path" : "source/includes/fact-environments-onprem-only.rst" + }, { + "blob" : "a5cdd66b913b1f650b648124247c19889cbc6f59", + "path" : "source/includes/fact-bson-types.rst" + }, { + "blob" : "4e2e022eb95865da7e7a6bab33d940ac804f8810", + "path" : "source/includes/extracts-4.2-changes.yaml" + } ], + "justification" : "The page runs db.grades.find({classAverage: {$type: [2, 1]}}) and db.grades.find({classAverage: {$type: [\"string\", \"double\"]}}) with one shared result; BSON type numbers 2 and 1 are the aliases \"string\" and \"double\".", + "lock" : "the docs had two actions showing the two forms. picked the form morphia uses.", + "marker" : "lock", + "origin" : "f5efa7c2b14d22ec139f3ea5a0e37bca1aefa874", + "pageBlob" : "0902d6a741899af1732131889743c75df2d9cc6e", + "retypes" : [ ], + "rules" : [ "ALTERNATIVE_COMMANDS" ], + "source" : { + "commit" : "4431b1043d025a36ca3b64c17b3398de606ec6e8", + "path" : "source/reference/operator/query/type.txt", + "relation" : "AT_ORIGIN" + } }, { "corrections" : [ { "curated" : "{\"v\": \"crafts\"}", diff --git a/audits/catalog/legacy-references.json b/audits/catalog/legacy-references.json index 54f999d327f..9fc3b880646 100644 --- a/audits/catalog/legacy-references.json +++ b/audits/catalog/legacy-references.json @@ -5793,43 +5793,6 @@ "relation" : "AT_ORIGIN" }, "unexpandedIncludes" : [ ] - }, { - "blocks" : [ { - "role" : "ACTION", - "sha256" : "77142b787e783ee8c05ae6136926b5f5739eb5b9c584cd0977285b1e6333d795", - "text" : "db.trigonometry.aggregate([\n {\n $addFields : {\n \"side_b\" : {\n $multiply : [\n { $tan : \"$angle_a\" },\n \"$side_a\"\n ]\n }\n }\n }\n])" - }, { - "role" : "DATA", - "sha256" : "86d99dc80f1634fe9ea1a12556239d3018f989cb4b6f9d615a724f29966f75e9", - "text" : "{\n \"_id\" : ObjectId(\"5c50782193f833234ba90d85\"),\n \"angle_a\" : NumberDecimal(\"0.9272952180016122324285124629224288\"),\n \"side_a\" : NumberDecimal(\"3\")\n}" - }, { - "role" : "EXPECTED", - "sha256" : "5444d2c5b6bce8da1745110d55be58c5c71650880c51beb8e542bae43e494909", - "text" : "{\n \"_id\" : ObjectId(\"5c50782193f833234ba90d85\"),\n \"angle_a\" : NumberDecimal(\"0.9272952180016122324285124629224288\"),\n \"side_a\" : NumberDecimal(\"3\")\n \"side_b\" : NumberDecimal(\"3.999999999999999999999999999999999\")\n}" - } ], - "collections" : { }, - "corrections" : [ ], - "example" : "main :: Tangent of Value in Radians", - "fixture" : "aggregation/expressions/tan/tangentOfValueInRadians", - "fixtureFiles" : { - "action.json" : "996a16cd8f0fc500f6c70207c16c5fe5394bc3417543d3457e47d18d6369395e", - "data.json" : "fd1f3c01af034e96548f5056994d7debe99c6ce7a330aea1e56e6caf09a423ba", - "expected.json" : "e45e98a10aad1cd7060ca3fa3d3566d774330eec741f74d7c5c134428b36372e", - "name" : "85550610332a687515dc5c999ff1738f22eb8164fdabad152f2c32cc31ca1a88" - }, - "includes" : [ ], - "origin" : "3ed9dc5c1fb30de5717e0d52d8b63a1f7a17bf8d", - "pageBlob" : "d1af0fc1680338f19f53ff6357bd368eb498a86b", - "retiredLock" : null, - "retypes" : [ ], - "rules" : [ ], - "shape" : "PIPELINE", - "source" : { - "commit" : "8562c94b38de3e8c83552bcd41558548e5220eef", - "path" : "source/reference/operator/aggregation/tan.txt", - "relation" : "AT_ORIGIN" - }, - "unexpandedIncludes" : [ ] }, { "blocks" : [ { "role" : "ACTION", @@ -11137,7 +11100,7 @@ "gap.REJECTED" : 0, "gap.RESIDUAL_DIFFERENCE" : 0, "gap.SOURCE_UNSUPPORTED" : 0, - "references" : 251, + "references" : 250, "references.afterOrigin" : 0, "references.printed" : 1, "unresolved" : 0 diff --git a/audits/catalog/repair-review.json b/audits/catalog/repair-review.json index 36a579cda71..75a1af70402 100644 --- a/audits/catalog/repair-review.json +++ b/audits/catalog/repair-review.json @@ -113,7 +113,6 @@ "update the docs version to use the short version morphia generates": "MORPHIA_FORM", "update the lookup collection name": "FIXTURE_CURATION", "update the name of the target collection for the merge": "FIXTURE_CURATION", - "updated pipeline order": "MORPHIA_FORM", "updated the collection name in from": "FIXTURE_CURATION", "updated the timestamp format": "SHELL_SYNTAX", "use 0 instead of false to suppress _id": "MORPHIA_FORM", diff --git a/audits/src/main/kotlin/dev/morphia/audits/repairs/FixtureMigration.kt b/audits/src/main/kotlin/dev/morphia/audits/repairs/FixtureMigration.kt index b7b14f3bcb9..8ed7ad5c8a4 100644 --- a/audits/src/main/kotlin/dev/morphia/audits/repairs/FixtureMigration.kt +++ b/audits/src/main/kotlin/dev/morphia/audits/repairs/FixtureMigration.kt @@ -62,8 +62,16 @@ data class MigratedFixture( * not return (a page error), or that cannot be read. Serialization and behavior stay strict. */ @get:JsonInclude(JsonInclude.Include.NON_NULL) val publishedSkip: String? = null, + /** + * Form rules a reviewer added for a case whose source is a pinned reference, which declares + * none: Morphia spells the documented command differently in a way the rule's reason covers. + */ + @get:JsonInclude(JsonInclude.Include.NON_NULL) val addedRules: AddedRules? = null, ) +/** Reviewed form rules for a referenced case, with the reason they apply. */ +data class AddedRules(val rules: List, val reason: String) + /** * A reviewed edit of a legacy fixture file: [fromSha256] is the digest the preserved corpus * records, and [reason] says why the file changed before it retired. @@ -271,6 +279,7 @@ object FixtureMigration { migrated.ordered, migrated.options, publishedSkip = migrated.publishedSkip, + addedRules = migrated.addedRules?.rules.orEmpty(), ) /** @@ -286,6 +295,7 @@ object FixtureMigration { options: List = emptyList(), dataset: String? = null, publishedSkip: String? = null, + addedRules: List = emptyList(), ): String { require(options.all { it.name in mappedOptions && it.name != "orderMatters" }) { "${override.fixture}: options ${options.map { it.name }} are not mapped" @@ -327,6 +337,23 @@ object FixtureMigration { action["multi"] = BsonBoolean(documented.many) } } + // The page's other spellings of the action, each in the same shape as the action. + if (documented.alternatives.isNotEmpty()) { + action["alternatives"] = + BsonArray( + documented.alternatives.map { values -> + when (documented.shape) { + ActionShape.PIPELINE -> BsonDocument("pipeline", BsonArray(values)) + ActionShape.FIND -> + BsonDocument("filter", values[0]).also { alternative -> + values.getOrNull(1)?.let { alternative["projection"] = it } + } + ActionShape.UPDATE -> + BsonDocument("filter", values[0]).append("update", values[1]) + } + } + ) + } val collections = BsonDocument() documented.data.toSortedMap().forEach { (name, rows) -> collections[name] = BsonArray(rows) @@ -372,7 +399,16 @@ object FixtureMigration { "comparison", BsonDocument() .append("order", BsonString(if (ordered) "ORDERED" else "UNORDERED")) - .append("rules", BsonArray(override.rules.map { BsonString(it.name) })) + .append( + "rules", + // Alternative commands travel as the action's alternatives, not a rule. + BsonArray( + (override.rules + addedRules) + .filter { it != FormRule.ALTERNATIVE_COMMANDS } + .distinct() + .map { BsonString(it.name) } + ), + ) .append( "ignore", BsonArray( @@ -543,8 +579,7 @@ object FixtureMigration { /** * Why the case of [override] cannot be converted yet, or null when the adapter supports it: a - * case run by one of [helpers] with mapped options and a documented source without alternative - * commands. + * case run by one of [helpers] with mapped options. */ fun convertible(override: FormOverride, example: CuratedExample): String? = when { @@ -552,7 +587,6 @@ object FixtureMigration { "only cases that run one of $helpers can be converted" !example.options.all { it.name == "orderMatters" || it.name in mappedOptions } -> "options ${example.options.map { it.name }} are not mapped yet" - FormRule.ALTERNATIVE_COMMANDS in override.rules -> "alternative commands" else -> null } @@ -616,13 +650,7 @@ object FixtureMigration { return ledger.copy( migrations = ledger.migrations.map { migrated -> - val text = - scenario( - migrated.override, - migrated.ordered, - migrated.options, - publishedSkip = migrated.publishedSkip, - ) + val text = scenario(migrated) Files.writeString(root.resolve(migrated.scenario), text) migrated.copy(scenarioSha256 = sha256(text.toByteArray())) } @@ -869,15 +897,7 @@ object FixtureMigration { if (sha256(text.toByteArray()) != migrated.scenarioSha256) { problems += "${migrated.fixture}: scenario changed since the migration" } - if ( - text != - scenario( - migrated.override, - migrated.ordered, - migrated.options, - publishedSkip = migrated.publishedSkip, - ) - ) { + if (text != scenario(migrated)) { problems += "${migrated.fixture}: scenario is not its override's documented source" } diff --git a/audits/src/main/kotlin/dev/morphia/audits/repairs/FormMigration.kt b/audits/src/main/kotlin/dev/morphia/audits/repairs/FormMigration.kt index e78890d131e..eea900f9e43 100644 --- a/audits/src/main/kotlin/dev/morphia/audits/repairs/FormMigration.kt +++ b/audits/src/main/kotlin/dev/morphia/audits/repairs/FormMigration.kt @@ -203,6 +203,8 @@ data class DocumentedScenario( val documents: List? = null, /** The indexes the page creates before the action, in order. */ val indexes: List = emptyList(), + /** The page's other spellings of the action, when it declares alternative commands. */ + val alternatives: List> = emptyList(), ) data class FormOverride( @@ -999,13 +1001,16 @@ object FormMigration { label: String, shape: ActionShape?, blocks: List, + alternatives: Boolean = false, ): DocumentedScenario { val documented = when (val parsed = documented(blocks)) { is Examined.Gap -> throw IllegalArgumentException("$label: ${parsed.detail}") else -> parsed as Documented } - val action = documented.alternatives.single() + // Alternative commands, when declared, are the page's equivalent spellings of one action. + val action = + if (alternatives) documented.alternatives.first() else documented.alternatives.single() require(shape == null || action.shape == shape) { "$label: action is ${action.shape}" } val expected = blocks.filter { it.role == BlockRole.EXPECTED } val printed = @@ -1025,26 +1030,30 @@ object FormMigration { action.many, listed.takeIf { it.isNotEmpty() && it.all { rows -> rows != null } }?.flatMap { it!! }, indexes = documented.indexes, + alternatives = + if (alternatives) documented.alternatives.drop(1).map { it.values } else emptyList(), ) } /** * The documented operation an override was proven against, read from its recorded source text. * Its declared rules travel with it to the runner, and its retypes and corrections are applied - * by `FixtureMigration`; alternative commands are not supported. + * by `FixtureMigration`; declared alternative commands travel as the action's alternatives. */ fun documented(override: FormOverride): DocumentedScenario { // The documented data names every collection, so a test's extra collections need nothing // more; their legacy data files were loaded under those same names. - require(FormRule.ALTERNATIVE_COMMANDS !in override.rules) { - "${override.fixture}: alternative commands are not supported" - } override.blocks.forEach { require(sha256(it.text.toByteArray()) == it.sha256) { "${override.fixture}: ${it.role} source text digest mismatch" } } - return documented(override.fixture, override.shape, override.blocks) + return documented( + override.fixture, + override.shape, + override.blocks, + FormRule.ALTERNATIVE_COMMANDS in override.rules, + ) } private data class Action( diff --git a/audits/src/test/kotlin/dev/morphia/audits/offline/CuratedRepairsTest.kt b/audits/src/test/kotlin/dev/morphia/audits/offline/CuratedRepairsTest.kt index 4be5160265b..15f755ad0f5 100644 --- a/audits/src/test/kotlin/dev/morphia/audits/offline/CuratedRepairsTest.kt +++ b/audits/src/test/kotlin/dev/morphia/audits/offline/CuratedRepairsTest.kt @@ -322,7 +322,7 @@ class CuratedRepairsTest { assertEquals(read("audits/catalog/curated-repairs.json"), AuditJson.write(report)) assertEquals(0, report.summary["examples.locked"]) - assertEquals(137, report.summary["disposition.OVERRIDDEN"]) + assertEquals(135, report.summary["disposition.OVERRIDDEN"]) assertEquals(17, report.exclusions.size) assertEquals( 0, diff --git a/audits/src/test/kotlin/dev/morphia/audits/offline/FixtureMigrationTest.kt b/audits/src/test/kotlin/dev/morphia/audits/offline/FixtureMigrationTest.kt index 48a7676496f..c31f4c1f724 100644 --- a/audits/src/test/kotlin/dev/morphia/audits/offline/FixtureMigrationTest.kt +++ b/audits/src/test/kotlin/dev/morphia/audits/offline/FixtureMigrationTest.kt @@ -2,9 +2,13 @@ package dev.morphia.audits.offline import dev.morphia.audits.coverage.AuditJson import dev.morphia.audits.generate.Candidates +import dev.morphia.audits.repairs.CONVERTED import dev.morphia.audits.repairs.CaseManifests +import dev.morphia.audits.repairs.CutoverCheck import dev.morphia.audits.repairs.FixtureMigration import dev.morphia.audits.repairs.FormRule +import dev.morphia.audits.repairs.GENERATED +import dev.morphia.audits.repairs.LegacyOnly import dev.morphia.audits.repairs.MIGRATED import java.nio.file.Files import java.nio.file.Path @@ -165,11 +169,18 @@ class FixtureMigrationTest { AuditJson.legacyReferences(read("audits/catalog/legacy-references.json")), AuditJson.curatedRepairs(read("audits/catalog/curated-repairs.json")), ) + // Every documented case has moved; a legacy-only record of a moved case is refused. + assertEquals(emptyList(), cutover.legacyOnly) val moved = cutover.copy( legacyOnly = - cutover.legacyOnly + - cutover.legacyOnly.first().copy(fixture = ledger.migrations.first().fixture) + listOf( + LegacyOnly( + ledger.migrations.first().fixture, + CutoverCheck.PUBLISHED, + "a moved case", + ) + ) ) assertThrows(IllegalArgumentException::class.java) { FixtureMigration.verifyCutover( @@ -181,18 +192,6 @@ class FixtureMigrationTest { AuditJson.curatedRepairs(read("audits/catalog/curated-repairs.json")), ) } - // A convertible case the batch skipped is caught: drop one legacy-only record. - val skipped = cutover.copy(legacyOnly = cutover.legacyOnly.drop(1)) - assertThrows(IllegalArgumentException::class.java) { - FixtureMigration.verifyCutover( - root, - skipped, - ledger, - AuditJson.formMigration(read("audits/catalog/form-migration.json")), - AuditJson.legacyReferences(read("audits/catalog/legacy-references.json")), - AuditJson.curatedRepairs(read("audits/catalog/curated-repairs.json")), - ) - } } @Test @@ -204,18 +203,14 @@ class FixtureMigrationTest { read("core/src/test/resources/dev/morphia/test/example-bindings.json") ) CaseManifests.owners(descriptor, manifest) - // An example the manifest does not already own; a converted case names its legacy test. - val owned = manifest.cases.map { it.name }.toSet() - val unowned = - descriptor.classes - .flatMap { type -> - type.bindings.map { - "${type.resources.removePrefix("dev/morphia/test/")}/${it.resource}" - } - } - .first { it !in owned } + // A converted case's example claimed again by a generated case has two owners. + val converted = manifest.cases.first { it.kind == CONVERTED } val claimed = - manifest.copy(cases = manifest.cases + manifest.cases.first().copy(name = unowned)) + manifest.copy( + cases = + manifest.cases + + manifest.cases.first { it.kind == GENERATED }.copy(name = converted.name) + ) val failure = assertThrows(IllegalArgumentException::class.java) { CaseManifests.owners(descriptor, claimed) diff --git a/audits/src/test/kotlin/dev/morphia/audits/offline/FormMigrationTest.kt b/audits/src/test/kotlin/dev/morphia/audits/offline/FormMigrationTest.kt index 1bdb7e90330..aed5d5ad54f 100644 --- a/audits/src/test/kotlin/dev/morphia/audits/offline/FormMigrationTest.kt +++ b/audits/src/test/kotlin/dev/morphia/audits/offline/FormMigrationTest.kt @@ -989,7 +989,7 @@ class FormMigrationTest { .map { it.fixture } .toSet(), ) - assertEquals(3, report.overrides.size) + assertEquals(0, report.overrides.size) assertEquals(0, report.unresolved.size) } @@ -1024,7 +1024,7 @@ class FormMigrationTest { .toSet(), (report.references.map { it.fixture } + report.unresolved.map { it.fixture }).toSet(), ) - assertEquals(251, report.references.size) + assertEquals(250, report.references.size) assertEquals(0, report.unresolved.size) } diff --git a/core/src/test/java/dev/morphia/test/OperatorCaseRunner.java b/core/src/test/java/dev/morphia/test/OperatorCaseRunner.java index f7a6d9aa0ab..66ea8943323 100644 --- a/core/src/test/java/dev/morphia/test/OperatorCaseRunner.java +++ b/core/src/test/java/dev/morphia/test/OperatorCaseRunner.java @@ -266,12 +266,27 @@ private void run(OperatorCase operatorCase, String kind, Shape shape, Set rules = EnumSet.noneOf(Rule.class); scenario.getDocument("comparison").getArray("rules") .forEach(rule -> rules.add(Rule.valueOf(rule.asString().getValue()))); - if (!skipped.containsKey("serialization") - && !StrictBson.equal(new BsonArray(FormRules.canonical(documented.getValues(), shape, rules)), - new BsonArray(FormRules.canonical(execution.emitted().getValues(), shape, rules)))) { + // A page may document equivalent spellings of the action; Morphia's must equal one of them, and the reference + // then runs that one. + List spellings = new ArrayList<>(List.of(action)); + action.getArray("alternatives", new BsonArray()).forEach(alternative -> { + BsonDocument spelling = action.clone(); + spelling.remove("alternatives"); + spelling.putAll(alternative.asDocument()); + spellings.add(spelling); + }); + BsonArray emitted = execution.emitted(); + BsonDocument matched = spellings.stream() + .filter(spelling -> StrictBson.equal(new BsonArray(FormRules.canonical(documented(spelling).getValues(), shape, rules)), + new BsonArray(FormRules.canonical(emitted.getValues(), shape, rules)))) + .findFirst().orElse(null); + if (!skipped.containsKey("serialization") && matched == null) { fail(operatorCase.resource() + ": serialization differs\ndocumented: " + json(documented) + "\nmorphia: " + json(execution.emitted())); } + if (matched != null && matched != action) { + execution = plan.apply(matched, collection); + } // The legacy test did not run the action, so neither does its case; the scenario names why. if (skipped.containsKey("results")) { return; @@ -401,7 +416,9 @@ private static void supported(OperatorCase operatorCase, BsonDocument scenario) case "update" -> Set.of("kind", "collection", "filter", "update", "multi"); default -> Set.of(); }; - if (!action.keySet().equals(fields)) { + Set present = new TreeSet<>(action.keySet()); + present.remove("alternatives"); + if (!present.equals(fields)) { unsupported.add("action fields " + action.keySet()); } else if (action.getString("kind").getValue().equals("aggregate")) { for (BsonValue stage : action.getArray("pipeline")) { diff --git a/core/src/test/java/dev/morphia/test/aggregation/expressions/TestTan.java b/core/src/test/java/dev/morphia/test/aggregation/expressions/TestTan.java deleted file mode 100644 index 7a10c946267..00000000000 --- a/core/src/test/java/dev/morphia/test/aggregation/expressions/TestTan.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.morphia.test.aggregation.expressions; - -import dev.morphia.test.TemplatedTestBase; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import static dev.morphia.aggregation.expressions.MathExpressions.multiply; -import static dev.morphia.aggregation.expressions.TrigonometryExpressions.tan; -import static dev.morphia.aggregation.stages.AddFields.addFields; - -public class TestTan extends TemplatedTestBase { - /** - * test data: dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians - * - */ - @Test - @DisplayName("main :: Tangent of Value in Radians") - public void testTangentOfValueInRadians() { - testPipeline((aggregation) -> aggregation - .pipeline(addFields().field("side_b", multiply(tan("$angle_a"), "$side_a")))); - } - -} diff --git a/core/src/test/java/dev/morphia/test/aggregation/stages/TestDensify.java b/core/src/test/java/dev/morphia/test/aggregation/stages/TestDensify.java deleted file mode 100644 index 303ebd10e47..00000000000 --- a/core/src/test/java/dev/morphia/test/aggregation/stages/TestDensify.java +++ /dev/null @@ -1,40 +0,0 @@ -package dev.morphia.test.aggregation.stages; - -import java.time.ZonedDateTime; - -import dev.morphia.aggregation.stages.Densify.Range; -import dev.morphia.test.TemplatedTestBase; -import dev.morphia.test.util.ActionTestOptions; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import static dev.morphia.aggregation.expressions.TimeUnit.HOUR; -import static dev.morphia.aggregation.stages.Densify.densify; - -public class TestDensify extends TemplatedTestBase { - - @BeforeEach - public void versionCheck() { - checkMinServerVersion("5.1.0"); - } - - /** - * test data: dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData - * - */ - @Test - @DisplayName("Densify Time Series Data") - public void testDensifyTimeSeriesData() { - testPipeline( - new ActionTestOptions().removeIds(true), ( - aggregation) -> aggregation - .pipeline( - densify("timestamp", - Range.bounded(ZonedDateTime.parse("2021-05-18T00:00:00.000Z"), - ZonedDateTime.parse("2021-05-18T08:00:00.000Z"), 1) - .unit(HOUR)))); - } - -} \ No newline at end of file diff --git a/core/src/test/java/dev/morphia/test/aggregation/stages/TestGraphLookup.java b/core/src/test/java/dev/morphia/test/aggregation/stages/TestGraphLookup.java index c06ba4b307f..2d449db08be 100644 --- a/core/src/test/java/dev/morphia/test/aggregation/stages/TestGraphLookup.java +++ b/core/src/test/java/dev/morphia/test/aggregation/stages/TestGraphLookup.java @@ -24,21 +24,6 @@ public void testWithinASingleCollection() { .connectFromField("reportsTo").connectToField("name").as("reportingHierarchy"))); } - /** - * test data: dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections - * - */ - @Test - @DisplayName("Across Multiple Collections") - public void testAcrossMultipleCollections() { - loadData("airports", 2); - - testPipeline(new ActionTestOptions().orderMatters(false), - (aggregation) -> aggregation.pipeline(graphLookup("airports").startWith("$nearestAirport") - .connectFromField("connects").connectToField("airport").maxDepth(2).depthField("numConnections") - .as("destinations"))); - } - /** * test data: dev/morphia/test/aggregation/stages/graphLookup/withAQueryFilter * diff --git a/core/src/test/java/dev/morphia/test/query/filters/TestRand.java b/core/src/test/java/dev/morphia/test/query/filters/TestRand.java index d1a84e3dc52..c35f388625c 100644 --- a/core/src/test/java/dev/morphia/test/query/filters/TestRand.java +++ b/core/src/test/java/dev/morphia/test/query/filters/TestRand.java @@ -21,7 +21,7 @@ public class TestRand extends TemplatedTestBase { @DisplayName("Select Random Items From a Collection") public void testSelectRandomItemsFromACollection() { ActionTestOptions options = new ActionTestOptions().orderMatters(false).removeIds(true).skipDataCheck(true) - .findOptions(new FindOptions().projection().include("name", "registered")); + .findOptions(new FindOptions().projection().include("name", "registered").projection().exclude("_id")); testQuery(options, (query) -> query.filter(eq("district", 3), expr(lt(0.5, rand())))); } } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/action.json b/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/action.json deleted file mode 100644 index 7f6caee5d71..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/action.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - $addFields : { - "side_b" : { - $multiply : [ - { $tan : "$angle_a" }, - "$side_a" - ] - } - } - } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/data.json b/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/data.json deleted file mode 100644 index 84b3f46ad1d..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/data.json +++ /dev/null @@ -1 +0,0 @@ -{ "_id" : ObjectId("5c50782193f833234ba90d85"), "angle_a" : NumberDecimal("0.9272952180016122324285124629224288"), "side_a" : NumberDecimal("3")} \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/expected.json b/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/expected.json deleted file mode 100644 index 1fa56b57099..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/expected.json +++ /dev/null @@ -1 +0,0 @@ -{ "_id" : ObjectId("5c50782193f833234ba90d85"), "angle_a" : NumberDecimal("0.9272952180016122324285124629224288"), "side_a" : NumberDecimal("3") "side_b" : NumberDecimal("3.999999999999999999999999999999999")} \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/name b/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/name deleted file mode 100644 index fc2631a42d8..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/expressions/tan/tangentOfValueInRadians/name +++ /dev/null @@ -1 +0,0 @@ -main :: Tangent of Value in Radians \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/action.json b/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/action.json deleted file mode 100644 index ab04dc4b865..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/action.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - $densify: { - field: "timestamp", - range: { - step: 1, - unit: "hour", - bounds:[ ISODate("2021-05-18T00:00:00.000Z"), ISODate("2021-05-18T08:00:00.000Z") ] - } - } - } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/data.json b/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/data.json deleted file mode 100644 index 35d2b53cf01..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/data.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "metadata": { "sensorId": 5578, "type": "temperature" }, "timestamp": ISODate("2021-05-18T00:00:00.000Z"), "temp": 12 }, -{ "metadata": { "sensorId": 5578, "type": "temperature" }, "timestamp": ISODate("2021-05-18T04:00:00.000Z"), "temp": 11 }, -{ "metadata": { "sensorId": 5578, "type": "temperature" }, "timestamp": ISODate("2021-05-18T08:00:00.000Z"), "temp": 11 }, -{ "metadata": { "sensorId": 5578, "type": "temperature" }, "timestamp": ISODate("2021-05-18T12:00:00.000Z"), "temp": 12 } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/expected.json b/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/expected.json deleted file mode 100644 index 0eb8c3ab0cf..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/expected.json +++ /dev/null @@ -1,10 +0,0 @@ -{ _id: ObjectId("618c207c63056cfad0ca4309"), metadata: { sensorId: 5578, type: 'temperature' }, timestamp: ISODate("2021-05-18T00:00:00.000Z"), temp: 12 }, -{ timestamp: ISODate("2021-05-18T01:00:00.000Z") }, -{ timestamp: ISODate("2021-05-18T02:00:00.000Z") }, -{ timestamp: ISODate("2021-05-18T03:00:00.000Z") }, -{ _id: ObjectId("618c207c63056cfad0ca430a"), metadata: { sensorId: 5578, type: 'temperature' }, timestamp: ISODate("2021-05-18T04:00:00.000Z"), temp: 11 }, -{ timestamp: ISODate("2021-05-18T05:00:00.000Z") }, -{ timestamp: ISODate("2021-05-18T06:00:00.000Z") }, -{ timestamp: ISODate("2021-05-18T07:00:00.000Z") }, -{ _id: ObjectId("618c207c63056cfad0ca430b"), metadata: { sensorId: 5578, type: 'temperature' }, timestamp: ISODate("2021-05-18T08:00:00.000Z"), temp: 11 } -{ _id: ObjectId("618c207c63056cfad0ca430c"), metadata: { sensorId: 5578, type: 'temperature' }, timestamp: ISODate("2021-05-18T12:00:00.000Z"), temp: 12 } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/name b/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/name deleted file mode 100644 index 95754379093..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/densify/densifyTimeSeriesData/name +++ /dev/null @@ -1 +0,0 @@ -Densify Time Series Data \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/action.json b/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/action.json deleted file mode 100644 index e30321bc53f..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/action.json +++ /dev/null @@ -1,13 +0,0 @@ - [ - { - $graphLookup: { - from: "airports", - startWith: "$nearestAirport", - connectFromField: "connects", - connectToField: "airport", - as: "destinations", - maxDepth: 2, - depthField: "numConnections" - } - } -] \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data.json b/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data.json deleted file mode 100644 index 6da6f79333f..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "_id" : 1, "name" : "Dev", "nearestAirport" : "JFK" }, -{ "_id" : 2, "name" : "Eliot", "nearestAirport" : "JFK" }, -{ "_id" : 3, "name" : "Jeff", "nearestAirport" : "BOS" } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data2.json b/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data2.json deleted file mode 100644 index a16f20c640b..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/data2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ] }, -{ "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ] }, -{ "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ] }, -{ "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ] }, -{ "_id" : 4, "airport" : "LHR", "connects" : [ "PWM" ] } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/expected.json b/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/expected.json deleted file mode 100644 index 144c0e6b20b..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/expected.json +++ /dev/null @@ -1,3 +0,0 @@ -{"_id" : 1, "name" : "Dev", "nearestAirport" : "JFK", "destinations" : [{ "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ], "numConnections" : NumberLong(2) }, { "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ], "numConnections" : NumberLong(1) }, { "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ], "numConnections" : NumberLong(1) }, { "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ], "numConnections" : NumberLong(0) }]} -{"_id" : 2, "name" : "Eliot", "nearestAirport" : "JFK", "destinations" : [{ "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ], "numConnections" : NumberLong(2) }, { "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ], "numConnections" : NumberLong(1) }, { "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ], "numConnections" : NumberLong(1) }, { "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ], "numConnections" : NumberLong(0) } ]} -{"_id" : 3, "name" : "Jeff", "nearestAirport" : "BOS", "destinations" : [{ "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ], "numConnections" : NumberLong(2) }, { "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ], "numConnections" : NumberLong(1) }, { "_id" : 4, "airport" : "LHR", "connects" : [ "PWM" ], "numConnections" : NumberLong(2) }, { "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ], "numConnections" : NumberLong(1) }, { "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ], "numConnections" : NumberLong(0) }]} \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/name b/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/name deleted file mode 100644 index 1b779bf63d4..00000000000 --- a/core/src/test/resources/dev/morphia/test/aggregation/stages/graphLookup/acrossMultipleCollections/name +++ /dev/null @@ -1 +0,0 @@ -Across Multiple Collections \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/example-bindings.json b/core/src/test/resources/dev/morphia/test/example-bindings.json index cabdc8c56bc..555d20aa6b1 100644 --- a/core/src/test/resources/dev/morphia/test/example-bindings.json +++ b/core/src/test/resources/dev/morphia/test/example-bindings.json @@ -1367,15 +1367,6 @@ "resources" : "dev/morphia/test/aggregation/expressions/switch", "type" : "dev.morphia.test.aggregation.expressions.TestSwitch", "unbound" : [ ] - }, { - "bindings" : [ { - "method" : "testTangentOfValueInRadians", - "resource" : "tangentOfValueInRadians" - } ], - "manual" : [ ], - "resources" : "dev/morphia/test/aggregation/expressions/tan", - "type" : "dev.morphia.test.aggregation.expressions.TestTan", - "unbound" : [ ] }, { "bindings" : [ { "method" : "testHyperbolicTangentInDegrees", @@ -1664,15 +1655,6 @@ "resources" : "dev/morphia/test/aggregation/stages/count", "type" : "dev.morphia.test.aggregation.stages.TestCount", "unbound" : [ ] - }, { - "bindings" : [ { - "method" : "testDensifyTimeSeriesData", - "resource" : "densifyTimeSeriesData" - } ], - "manual" : [ ], - "resources" : "dev/morphia/test/aggregation/stages/densify", - "type" : "dev.morphia.test.aggregation.stages.TestDensify", - "unbound" : [ ] }, { "bindings" : [ { "method" : "testUseADocumentsStageInALookupStage", @@ -1705,9 +1687,6 @@ "unbound" : [ ] }, { "bindings" : [ { - "method" : "testAcrossMultipleCollections", - "resource" : "acrossMultipleCollections" - }, { "method" : "testWithAQueryFilter", "resource" : "withAQueryFilter" }, { diff --git a/core/src/test/resources/dev/morphia/test/generated/manifest.json b/core/src/test/resources/dev/morphia/test/generated/manifest.json index e552b17fc18..82dc6ff1b57 100644 --- a/core/src/test/resources/dev/morphia/test/generated/manifest.json +++ b/core/src/test/resources/dev/morphia/test/generated/manifest.json @@ -1859,6 +1859,11 @@ "name" : "query/filters/polygon/polygonQueryPredicateOperator", "scenario" : "/dev/morphia/test/query/filters/polygon/polygonQueryPredicateOperator/scenario.json", "test" : "dev.morphia.test.query.filters.TestPolygon#testPolygonQueryPredicateOperator" + }, { + "kind" : "CONVERTED", + "name" : "query/filters/rand/selectRandomItemsFromACollection", + "scenario" : "/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/scenario.json", + "test" : "dev.morphia.test.query.filters.TestRand#testSelectRandomItemsFromACollection" }, { "kind" : "CONVERTED", "name" : "query/filters/regex/extendRegexOptionsToMatchCharactersOutsideOfAscii", @@ -1904,6 +1909,11 @@ "name" : "query/filters/text/textWithAnExactString", "scenario" : "/dev/morphia/test/query/filters/text/textWithAnExactString/scenario.json", "test" : "dev.morphia.test.query.filters.TestText#testTextWithAnExactString" + }, { + "kind" : "CONVERTED", + "name" : "query/filters/type/queryingByMultipleDataTypes", + "scenario" : "/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/scenario.json", + "test" : "dev.morphia.test.query.filters.TestType#testQueryingByMultipleDataTypes" }, { "kind" : "GENERATED", "name" : "query/updates/addToSet/addToArray", @@ -3746,6 +3756,10 @@ "owner" : "GENERATED", "path" : "src/test/resources/dev/morphia/test/query/filters/polygon/polygonQueryPredicateOperator/scenario.json", "sha256" : "bfd3628c1fe644cb1a33c89f2fa73bceca2fcb64d4792c3c04fe8a4fb94aef75" + }, { + "owner" : "GENERATED", + "path" : "src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/scenario.json", + "sha256" : "5a272c76a0edc50fe27e476ae3420fc19b391c103fa5d5f2907a04443570657b" }, { "owner" : "GENERATED", "path" : "src/test/resources/dev/morphia/test/query/filters/regex/extendRegexOptionsToMatchCharactersOutsideOfAscii/scenario.json", @@ -3782,6 +3796,10 @@ "owner" : "GENERATED", "path" : "src/test/resources/dev/morphia/test/query/filters/text/textWithAnExactString/scenario.json", "sha256" : "eb71dbdc9a7918a19a15f805128266ed7383946a1a18134634a8dee607563b60" + }, { + "owner" : "GENERATED", + "path" : "src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/scenario.json", + "sha256" : "79b96d4085bf99c0cb17ba929fe8b772d939d521a4666604e3af9d113275f6da" }, { "owner" : "GENERATED", "path" : "src/test/resources/dev/morphia/test/query/updates/addToSet/eachModifier/scenario.json", diff --git a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/action.json b/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/action.json deleted file mode 100644 index 3078b59707e..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/action.json +++ /dev/null @@ -1,6 +0,0 @@ -db.voters.find( - { district: 3, - $expr: { $lt: [0.5, {$rand: {} } ] } - }, - { _id: 0, name: 1, registered: 1 } -) \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/data.json b/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/data.json deleted file mode 100644 index 554d94c67fd..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/data.json +++ /dev/null @@ -1,10 +0,0 @@ -{ name: "Archibald", voterId: 4321, district: 3, registered: true }, -{ name: "Beckham", voterId: 4331, district: 3, registered: true }, -{ name: "Carolin", voterId: 5321, district: 4, registered: true }, -{ name: "Debarge", voterId: 4343, district: 3, registered: false }, -{ name: "Eckhard", voterId: 4161, district: 3, registered: false }, -{ name: "Faberge", voterId: 4300, district: 1, registered: true }, -{ name: "Grimwald", voterId: 4111, district: 3, registered: true }, -{ name: "Humphrey", voterId: 2021, district: 3, registered: true }, -{ name: "Idelfon", voterId: 1021, district: 4, registered: true }, -{ name: "Justo", voterId: 9891, district: 3, registered: false } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/expected.json b/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/expected.json deleted file mode 100644 index 1e4c3738697..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/expected.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name" : "Beckham", "registered" : true } -{ "name" : "Eckhard", "registered" : false } -{ "name" : "Grimwald", "registered" : true } -{ "name" : "Humphrey", "registered" : true } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/name b/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/name deleted file mode 100644 index d113a4d5147..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/name +++ /dev/null @@ -1 +0,0 @@ -Select Random Items From a Collection \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/scenario.json b/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/scenario.json new file mode 100644 index 00000000000..8812138c118 --- /dev/null +++ b/core/src/test/resources/dev/morphia/test/query/filters/rand/selectRandomItemsFromACollection/scenario.json @@ -0,0 +1,235 @@ +{ + "schemaVersion": { + "$numberInt": "1" + }, + "name": "query/filters/rand/selectRandomItemsFromACollection", + "title": "Select Random Items From a Collection", + "context": "FILTER", + "source": { + "repository": "mongodb/docs", + "commit": "65d54987f7f4008507de4346d3c4c5ca37b8ec21", + "path": "source/reference/operator/query/rand.txt", + "blob": "536ca45ea56b6ae5c998d9a4e7d2b452d9f10e0b" + }, + "dataset": null, + "collections": { + "voters": [ + { + "name": "Archibald", + "voterId": { + "$numberInt": "4321" + }, + "district": { + "$numberInt": "3" + }, + "registered": true + }, + { + "name": "Beckham", + "voterId": { + "$numberInt": "4331" + }, + "district": { + "$numberInt": "3" + }, + "registered": true + }, + { + "name": "Carolin", + "voterId": { + "$numberInt": "5321" + }, + "district": { + "$numberInt": "4" + }, + "registered": true + }, + { + "name": "Debarge", + "voterId": { + "$numberInt": "4343" + }, + "district": { + "$numberInt": "3" + }, + "registered": false + }, + { + "name": "Eckhard", + "voterId": { + "$numberInt": "4161" + }, + "district": { + "$numberInt": "3" + }, + "registered": false + }, + { + "name": "Faberge", + "voterId": { + "$numberInt": "4300" + }, + "district": { + "$numberInt": "1" + }, + "registered": true + }, + { + "name": "Grimwald", + "voterId": { + "$numberInt": "4111" + }, + "district": { + "$numberInt": "3" + }, + "registered": true + }, + { + "name": "Humphrey", + "voterId": { + "$numberInt": "2021" + }, + "district": { + "$numberInt": "3" + }, + "registered": true + }, + { + "name": "Idelfon", + "voterId": { + "$numberInt": "1021" + }, + "district": { + "$numberInt": "4" + }, + "registered": true + }, + { + "name": "Justo", + "voterId": { + "$numberInt": "9891" + }, + "district": { + "$numberInt": "3" + }, + "registered": false + } + ] + }, + "indexes": [], + "action": { + "kind": "find", + "collection": "voters", + "filter": { + "district": { + "$numberInt": "3" + }, + "$expr": { + "$lt": [ + { + "$numberDouble": "0.5" + }, + { + "$rand": {} + } + ] + } + }, + "projection": { + "_id": { + "$numberInt": "0" + }, + "name": { + "$numberInt": "1" + }, + "registered": { + "$numberInt": "1" + } + } + }, + "expected": { + "printed": [ + { + "document": [ + { + "name": "name", + "value": { + "text": "Beckham" + } + }, + { + "name": "registered", + "value": { + "exact": true + } + } + ] + }, + { + "document": [ + { + "name": "name", + "value": { + "text": "Eckhard" + } + }, + { + "name": "registered", + "value": { + "exact": false + } + } + ] + }, + { + "document": [ + { + "name": "name", + "value": { + "text": "Grimwald" + } + }, + { + "name": "registered", + "value": { + "exact": true + } + } + ] + }, + { + "document": [ + { + "name": "name", + "value": { + "text": "Humphrey" + } + }, + { + "name": "registered", + "value": { + "exact": true + } + } + ] + } + ] + }, + "comparison": { + "order": "UNORDERED", + "rules": [ + "PROJECT_ID_FIRST" + ], + "ignore": [ + "_id" + ], + "tolerance": null + }, + "requirements": { + "minimumServer": null, + "topology": "STANDALONE" + }, + "skipped": { + "results": "the legacy test skipped its data check (skipDataCheck)" + } +} diff --git a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/action.json b/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/action.json deleted file mode 100644 index 6596cad47c6..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/action.json +++ /dev/null @@ -1 +0,0 @@ -db.grades.find( { classAverage : { $type : [ "string" , "double" ] } } ) \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/data.json b/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/data.json deleted file mode 100644 index a566abbed93..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/data.json +++ /dev/null @@ -1,4 +0,0 @@ -{ _id : 1, name : "Alice King" , classAverage : 87.333333333333333 }, -{ _id : 2, name : "Bob Jenkins", classAverage : "83.52" }, -{ _id : 3, name : "Cathy Hart", classAverage: "94.06" }, -{ _id : 4, name : "Drew Williams" , classAverage : NumberInt("93") } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/expected.json b/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/expected.json deleted file mode 100644 index 4149fd0ba3b..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/expected.json +++ /dev/null @@ -1,3 +0,0 @@ -{ _id : 1, name : "Alice King", classAverage : 87.33333333333333 } -{ _id : 2, name : "Bob Jenkins", classAverage : "83.52" } -{ _id : 3, name : "Cathy Hart", classAverage : "94.06" } \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/name b/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/name deleted file mode 100644 index aa965a3b113..00000000000 --- a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/name +++ /dev/null @@ -1 +0,0 @@ -Querying by Multiple Data Types \ No newline at end of file diff --git a/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/scenario.json b/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/scenario.json new file mode 100644 index 00000000000..39450f81114 --- /dev/null +++ b/core/src/test/resources/dev/morphia/test/query/filters/type/queryingByMultipleDataTypes/scenario.json @@ -0,0 +1,168 @@ +{ + "schemaVersion": { + "$numberInt": "1" + }, + "name": "query/filters/type/queryingByMultipleDataTypes", + "title": "Querying by Multiple Data Types", + "context": "FILTER", + "source": { + "repository": "mongodb/docs", + "commit": "4431b1043d025a36ca3b64c17b3398de606ec6e8", + "path": "source/reference/operator/query/type.txt", + "blob": "0902d6a741899af1732131889743c75df2d9cc6e" + }, + "dataset": null, + "collections": { + "grades": [ + { + "_id": { + "$numberInt": "1" + }, + "name": "Alice King", + "classAverage": { + "$numberDouble": "87.33333333333333" + } + }, + { + "_id": { + "$numberInt": "2" + }, + "name": "Bob Jenkins", + "classAverage": "83.52" + }, + { + "_id": { + "$numberInt": "3" + }, + "name": "Cathy Hart", + "classAverage": "94.06" + }, + { + "_id": { + "$numberInt": "4" + }, + "name": "Drew Williams", + "classAverage": { + "$numberInt": "93" + } + } + ] + }, + "indexes": [], + "action": { + "kind": "find", + "collection": "grades", + "filter": { + "classAverage": { + "$type": [ + { + "$numberInt": "2" + }, + { + "$numberInt": "1" + } + ] + } + }, + "alternatives": [ + { + "filter": { + "classAverage": { + "$type": [ + "string", + "double" + ] + } + } + } + ] + }, + "expected": { + "printed": [ + { + "document": [ + { + "name": "_id", + "value": { + "whole": { + "$numberInt": "1" + } + } + }, + { + "name": "name", + "value": { + "text": "Alice King" + } + }, + { + "name": "classAverage", + "value": { + "exact": { + "$numberDouble": "87.33333333333333" + } + } + } + ] + }, + { + "document": [ + { + "name": "_id", + "value": { + "whole": { + "$numberInt": "2" + } + } + }, + { + "name": "name", + "value": { + "text": "Bob Jenkins" + } + }, + { + "name": "classAverage", + "value": { + "text": "83.52" + } + } + ] + }, + { + "document": [ + { + "name": "_id", + "value": { + "whole": { + "$numberInt": "3" + } + } + }, + { + "name": "name", + "value": { + "text": "Cathy Hart" + } + }, + { + "name": "classAverage", + "value": { + "text": "94.06" + } + } + ] + } + ] + }, + "comparison": { + "order": "ORDERED", + "rules": [], + "ignore": [], + "tolerance": null + }, + "requirements": { + "minimumServer": null, + "topology": "STANDALONE" + } +} diff --git a/design/operator-audits-design.md b/design/operator-audits-design.md index 6bcc68b0608..183fefbb28a 100644 --- a/design/operator-audits-design.md +++ b/design/operator-audits-design.md @@ -341,8 +341,11 @@ losing what the locks protected: corpus snapshot and the frozen binding catalog, as they do the migration ledger. With the legacy owner gone, the example's documented form is generated when its bindings allow. -The cases that stay on the legacy loader all have a documented source and fail a strict check; -the progress file tracks them. +No case stays on the legacy loader. A page may document equivalent spellings of an action +(declared `ALTERNATIVE_COMMANDS`): the scenario carries them as `action.alternatives`, Morphia's +command must equal one of them, and the reference runs that one. A referenced case, which declares +no rules, may carry reviewed `addedRules` in its ledger entry when Morphia spells the command +differently in a way a rule covers. ### Weekly discovery diff --git a/design/operator-audits-progress.md b/design/operator-audits-progress.md index d912fce146b..6596a628a37 100644 --- a/design/operator-audits-progress.md +++ b/design/operator-audits-progress.md @@ -44,13 +44,7 @@ Step 5, generation and cutover: - **Bindings for the remaining gaps** the weekly job files as issues (today `$serializeEJSON`, `$deserializeEJSON`, `$toObject`, `$toArray`, `$hexHash`, `$percentile`, `$limit`, `$type`, a compound `$group` `_id`, `$convert` options, `$reduce` `valueAs`). -- **The remaining legacy fixtures:** 5 directories, all with a documented source, and the last users - of the legacy loader: - - `tan/tangentOfValueInRadians`, `densify/densifyTimeSeriesData` and - `graphLookup/acrossMultipleCollections`: the page's printed results do not parse (page typos); - - `rand/selectRandomItemsFromACollection`: the page projects `_id` first, which a reference cannot - declare (`PROJECT_ID_FIRST`) and Morphia writes last; - - `type/queryingByMultipleDataTypes`: alternative commands, which conversion does not support. +- **The legacy fixture loader's code:** no legacy fixture directory remains; retire the loader. - **Deferred cutover features:** generated projections (converted cases carry theirs), update options (`arrayFilters`, `upsert`), update results as the page reads them (the whole collection, not the filter's matches), alternative commands. @@ -2728,3 +2722,17 @@ no product-documentation changes. Legacy operator AsciiDoc tables are intentiona unordered instead (#4568): their behavior check could differ between runs too, and every check stays strict. - 384 cases on the runner; 5 legacy directories. Core: 551 under each mapper. + +## The last legacy cases (2026-11-23) + +- Branch audits-last-legacy, as the user decided. +- `$type`'s "Querying by Multiple Data Types": declared alternative commands now convert. The + scenario carries the page's other spellings as `action.alternatives`; Morphia's command must equal + one, and the reference runs that one. +- `$rand`'s "Select Random Items From a Collection": its body gains the page's `_id` exclusion + (a reviewed body edit), and its ledger entry carries reviewed `addedRules` (`PROJECT_ID_FIRST`): + Morphia writes inclusions before exclusions, and a pinned reference declares no rules. +- `$tan` (radians), `$densify` (time series) and `$graphLookup` (across collections) are deleted: + their pages' printed results do not parse. The two declared ones record their already-retired + locks' digests too. +- No legacy fixture directory remains; 386 cases on the runner. Core: 548 under each mapper.