From 3660245169f9f10f484d0feead0c2dc08655e681 Mon Sep 17 00:00:00 2001 From: Patryk Kwiatek Date: Tue, 8 Aug 2023 06:34:02 +0000 Subject: [PATCH] Make aggregate documents compat tests pass for SQLite (#3150) --- .../aggregate_documents_compat_test.go | 625 +++++++++++++----- 1 file changed, 458 insertions(+), 167 deletions(-) diff --git a/integration/aggregate_documents_compat_test.go b/integration/aggregate_documents_compat_test.go index 54ce84ef424d..f8be2e7f919e 100644 --- a/integration/aggregate_documents_compat_test.go +++ b/integration/aggregate_documents_compat_test.go @@ -158,18 +158,17 @@ func testAggregateStagesCompatWithProviders(tt *testing.T, providers shareddata. }) } - var t testtb.TB = tt - if tc.failsForSQLite != "" { - t = setup.FailsForSQLite(tt, tc.failsForSQLite) + if tc.failsForSQLite != "" && setup.IsSQLite(tt) { + return } switch tc.resultType { case nonEmptyResult: - assert.True(t, nonEmptyResults, "expected non-empty results") + assert.True(tt, nonEmptyResults, "expected non-empty results") case emptyResult: - assert.False(t, nonEmptyResults, "expected empty results") + assert.False(tt, nonEmptyResults, "expected empty results") default: - t.Fatalf("unknown result type %v", tc.resultType) + tt.Fatalf("unknown result type %v", tc.resultType) } }) } @@ -180,15 +179,16 @@ type aggregateCommandCompatTestCase struct { command bson.D // required resultType compatTestCaseResultType // defaults to nonEmptyResult - skip string // skip test for all handlers, must have issue number mentioned + skip string // skip test for all handlers, must have issue number mentioned + failsForSQLite string // optional, if set, the case is expected to fail for SQLite due to given issue } // testAggregateCommandCompat tests aggregate pipeline compatibility test cases using one collection. // Use testAggregateStagesCompat for testing stages of aggregation. -func testAggregateCommandCompat(t *testing.T, testCases map[string]aggregateCommandCompatTestCase) { - t.Helper() +func testAggregateCommandCompat(tt *testing.T, testCases map[string]aggregateCommandCompatTestCase) { + tt.Helper() - s := setup.SetupCompatWithOpts(t, &setup.SetupCompatOpts{ + s := setup.SetupCompatWithOpts(tt, &setup.SetupCompatOpts{ // Use a provider that works for all handlers. Providers: []shareddata.Provider{shareddata.Int32s}, }) @@ -199,22 +199,27 @@ func testAggregateCommandCompat(t *testing.T, testCases map[string]aggregateComm for name, tc := range testCases { name, tc := name, tc - t.Run(name, func(t *testing.T) { - t.Helper() + tt.Run(name, func(tt *testing.T) { + tt.Helper() if tc.skip != "" { - t.Skip(tc.skip) + tt.Skip(tc.skip) } - t.Parallel() + tt.Parallel() command := tc.command - require.NotNil(t, command, "command should be set") + require.NotNil(tt, command, "command should be set") var nonEmptyResults bool - t.Run(targetCollection.Name(), func(t *testing.T) { - t.Helper() + tt.Run(targetCollection.Name(), func(tt *testing.T) { + tt.Helper() + + var t testtb.TB = tt + if tc.failsForSQLite != "" { + t = setup.FailsForSQLite(tt, tc.failsForSQLite) + } var targetRes, compatRes bson.D targetErr := targetCollection.Database().RunCommand(ctx, command).Decode(&targetRes) @@ -242,13 +247,17 @@ func testAggregateCommandCompat(t *testing.T, testCases map[string]aggregateComm } }) + if tc.failsForSQLite != "" && setup.IsSQLite(tt) { + return + } + switch tc.resultType { case nonEmptyResult: - assert.True(t, nonEmptyResults, "expected non-empty results") + assert.True(tt, nonEmptyResults, "expected non-empty results") case emptyResult: - assert.False(t, nonEmptyResults, "expected empty results") + assert.False(tt, nonEmptyResults, "expected empty results") default: - t.Fatalf("unknown result type %v", tc.resultType) + tt.Fatalf("unknown result type %v", tc.resultType) } }) } @@ -268,28 +277,32 @@ func TestAggregateCommandCompat(t *testing.T) { command: bson.D{ {"aggregate", 2}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "PipelineTypeMismatch": { command: bson.D{ {"aggregate", "collection-name"}, {"pipeline", 1}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "StageTypeMismatch": { command: bson.D{ {"aggregate", "collection-name"}, {"pipeline", bson.A{1}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidStage": { command: bson.D{ {"aggregate", "collection-name"}, {"pipeline", bson.A{"$invalid-stage"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxTimeMSDoubleWholeNumber": { command: bson.D{ @@ -298,6 +311,7 @@ func TestAggregateCommandCompat(t *testing.T) { {"cursor", bson.D{}}, {"maxTimeMS", float64(1000)}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -340,6 +354,7 @@ func TestAggregateCompatStages(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, resultPushdown: true, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountAndMatch": { pipeline: bson.A{ @@ -348,6 +363,7 @@ func TestAggregateCompatStages(t *testing.T) { bson.D{{"$match", bson.D{{"v", 1}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -365,7 +381,8 @@ func TestAggregateCompatEmptyPipeline(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "Empty": { - pipeline: bson.A{}, + pipeline: bson.A{}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -377,30 +394,37 @@ func TestAggregateCompatCount(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "Value": { - pipeline: bson.A{bson.D{{"$count", "v"}}}, + pipeline: bson.A{bson.D{{"$count", "v"}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistent": { - pipeline: bson.A{bson.D{{"$count", "nonexistent"}}}, + pipeline: bson.A{bson.D{{"$count", "nonexistent"}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountGroupID": { - pipeline: bson.A{bson.D{{"$count", "_id"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$count", "_id"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountNonString": { - pipeline: bson.A{bson.D{{"$count", 1}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$count", 1}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountEmpty": { - pipeline: bson.A{bson.D{{"$count", ""}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$count", ""}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountBadValue": { - pipeline: bson.A{bson.D{{"$count", "v.foo"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$count", "v.foo"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountBadPrefix": { - pipeline: bson.A{bson.D{{"$count", "$foo"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$count", "$foo"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -431,6 +455,7 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Distinct": { pipeline: bson.A{ @@ -459,6 +484,7 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "LimitAfter": { @@ -471,6 +497,7 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 5}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "LimitBefore": { pipeline: bson.A{ @@ -482,6 +509,7 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SkipAfter": { pipeline: bson.A{ @@ -493,6 +521,7 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", 2}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SkipBefore": { pipeline: bson.A{ @@ -504,6 +533,7 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -518,11 +548,13 @@ func TestAggregateCompatGroup(t *testing.T) { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DistinctID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$_id"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDExpression": { pipeline: bson.A{ @@ -532,6 +564,8 @@ func TestAggregateCompatGroup(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, + skip: "https://github.com/FerretDB/FerretDB/issues/2165", + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDExpressionNested": { pipeline: bson.A{ @@ -644,52 +678,61 @@ func TestAggregateCompatGroup(t *testing.T) { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$invalid"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExpressionID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "v"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonStringID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", bson.A{}}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "OperatorNameAsExpression": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$add"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyPath": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$"}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyVariable": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$"}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidVariable$": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$$"}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidVariable$s": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$$s"}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistingVariable": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$s"}, }}}}, - resultType: emptyResult, - skip: "https://github.com/FerretDB/FerretDB/issues/2275", + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + skip: "https://github.com/FerretDB/FerretDB/issues/2275", }, "SystemVariable": { pipeline: bson.A{bson.D{{"$group", bson.D{ @@ -699,39 +742,45 @@ func TestAggregateCompatGroup(t *testing.T) { skip: "https://github.com/FerretDB/FerretDB/issues/2275", }, "GroupInvalidFields": { - pipeline: bson.A{bson.D{{"$group", 1}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$group", 1}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyGroup": { - pipeline: bson.A{bson.D{{"$group", bson.D{}}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$group", bson.D{}}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MissingID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"bla", 1}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"v", 1}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"v", bson.D{}}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "GroupMultipleAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"v", bson.D{{"$count", "v"}, {"$count", "v"}}}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "GroupInvalidAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ @@ -746,6 +795,7 @@ func TestAggregateCompatGroup(t *testing.T) { {"_id", bson.D{{"$type", "$v"}}}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDSum": { pipeline: bson.A{ @@ -753,6 +803,7 @@ func TestAggregateCompatGroup(t *testing.T) { bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", "$v"}}}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDFieldSum": { pipeline: bson.A{ @@ -774,18 +825,21 @@ func TestAggregateCompatGroup(t *testing.T) { bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", "$non-existent"}}}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDSumInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", "$"}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDSumRecursiveInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", bson.D{{"$sum", "$"}}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -809,31 +863,37 @@ func TestAggregateCompatGroupExpressionDottedFields(t *testing.T) { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.foo"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DeeplyNested": { // Expect non-empty results for DocumentsDeeplyNested provider pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.a.b.c"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayIndex": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.0"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NestedInArray": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.0.foo"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistentParent": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$non.existent"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistentChild": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.non.existent"}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -874,32 +934,37 @@ func TestAggregateCompatGroupCount(t *testing.T) { {"_id", nil}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$_id"}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeMismatch": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"count", bson.D{{"$count", ""}}}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonEmptyExpression": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"count", bson.D{{"$count", bson.D{{"a", 1}}}}}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistentField": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$nonexistent"}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Duplicate": { pipeline: bson.A{bson.D{{"$group", bson.D{ @@ -907,7 +972,8 @@ func TestAggregateCompatGroupCount(t *testing.T) { {"count", bson.D{{"$count", bson.D{}}}}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -923,80 +989,92 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 0}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "One": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 1}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Five": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 5}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "StringInt": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", "5"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Double": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 4.5}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DoubleInt": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 5.0}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", math.MaxInt64}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MinInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", math.MinInt64}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Negative": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", -1}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NegativeDouble": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", -2.1}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Document": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", bson.D{}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int64Overflow": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", float64(1 << 86)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "AfterMatch": { pipeline: bson.A{ @@ -1005,6 +1083,7 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$limit", 1}}, }, resultPushdown: true, // $sort and $match are first two stages + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "BeforeMatch": { pipeline: bson.A{ @@ -1012,7 +1091,8 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$limit", 1}}, bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NoSortAfterMatch": { pipeline: bson.A{ @@ -1020,12 +1100,14 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$limit", 100}}, }, resultPushdown: true, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NoSortBeforeMatch": { pipeline: bson.A{ bson.D{{"$limit", 100}}, bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1062,6 +1144,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { // ascending sort for shareddata collections. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "GroupByID": { pipeline: bson.A{ @@ -1072,6 +1155,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "GroupByValue": { pipeline: bson.A{ @@ -1082,6 +1166,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyString": { pipeline: bson.A{ @@ -1092,6 +1177,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExpression": { pipeline: bson.A{ @@ -1102,6 +1188,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistent": { pipeline: bson.A{ @@ -1112,6 +1199,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Document": { pipeline: bson.A{ @@ -1123,6 +1211,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Array": { pipeline: bson.A{ @@ -1133,7 +1222,8 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int32": { pipeline: bson.A{ @@ -1144,6 +1234,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxInt32": { pipeline: bson.A{ @@ -1154,6 +1245,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NegativeInt32": { pipeline: bson.A{ @@ -1164,6 +1256,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int64": { pipeline: bson.A{ @@ -1174,6 +1267,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxInt64": { pipeline: bson.A{ @@ -1184,6 +1278,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Double": { pipeline: bson.A{ @@ -1194,6 +1289,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxDouble": { pipeline: bson.A{ @@ -1204,6 +1300,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Bool": { pipeline: bson.A{ @@ -1214,6 +1311,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Duplicate": { pipeline: bson.A{ @@ -1225,7 +1323,8 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveOperator": { pipeline: bson.A{ @@ -1237,18 +1336,21 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"sum", bson.D{{"$sum", bson.D{{"v", "$v"}}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveArrayInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"sum", bson.D{{"$sum", bson.D{{"$type", bson.A{"1", "2"}}}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveOperatorNonExistent": { pipeline: bson.A{ @@ -1258,7 +1360,8 @@ func TestAggregateCompatGroupSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.D{{"$non-existent", "$v"}}}}}, }}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1275,46 +1378,56 @@ func TestAggregateCompatMatch(t *testing.T) { "ID": { pipeline: bson.A{bson.D{{"$match", bson.D{{"_id", "string"}}}}}, resultPushdown: true, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v", 42}}}}, }, resultPushdown: true, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "String": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, resultPushdown: true, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Document": { - pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"foo", int32(42)}}}}}}}, + pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"foo", int32(42)}}}}}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Array": { - pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.A{int32(42)}}}}}}, + pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.A{int32(42)}}}}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Regex": { - pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"$eq", primitive.Regex{Pattern: "foo", Options: "i"}}}}}}}}, + pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"$eq", primitive.Regex{Pattern: "foo", Options: "i"}}}}}}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Empty": { pipeline: bson.A{ bson.D{{"$match", bson.D{}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationDocument": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v.foo", int32(42)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationArray": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v.0", int32(42)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MatchBadValue": { - pipeline: bson.A{bson.D{{"$match", 1}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$match", 1}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SumValue": { pipeline: bson.A{ @@ -1332,34 +1445,40 @@ func TestAggregateCompatSort(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "AscendingID": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 1}}}}}, + pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 1}}}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DescendingID": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", -1}}}}}, + pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", -1}}}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "AscendingValue": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DescendingValue": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", -1}, {"_id", 1}, // sort by _id when v is the same. }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "AscendingValueDescendingID": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", 1}, {"_id", -1}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DescendingValueDescendingID": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", -1}, {"_id", -1}, }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationIndex": { @@ -1367,35 +1486,42 @@ func TestAggregateCompatSort(t *testing.T) { {"v.0", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationNonExistent": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"invalid.foo", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationMissingField": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v..foo", 1}, }}}}, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SortBadExpression": { - pipeline: bson.A{bson.D{{"$sort", 1}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$sort", 1}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SortBadOrder": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 0}}}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 0}}}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SortMissingKey": { - pipeline: bson.A{bson.D{{"$sort", bson.D{}}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$sort", bson.D{}}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "BadDollarStart": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"$v.foo", 1}}}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$sort", bson.D{{"$v.foo", 1}}}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1415,6 +1541,7 @@ func TestAggregateCompatSortDotNotation(t *testing.T) { {"v.foo", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1430,97 +1557,116 @@ func TestAggregateCompatUnwind(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v"}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$non-existent"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Invalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "invalid"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.foo"}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.non-existent"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayDotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.0"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayDotNotationKey": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.0.foo"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Null": { - pipeline: bson.A{bson.D{{"$unwind", nil}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", nil}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$_id"}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NameAsExpression": { - pipeline: bson.A{bson.D{{"$unwind", "$add"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", "$add"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyPath": { - pipeline: bson.A{bson.D{{"$unwind", "$"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", "$"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyVariable": { - pipeline: bson.A{bson.D{{"$unwind", "$$"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", "$$"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidVariable$": { - pipeline: bson.A{bson.D{{"$unwind", "$$$"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", "$$$"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidVariable$s": { - pipeline: bson.A{bson.D{{"$unwind", "$$$s"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", "$$$s"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistingVariable": { - pipeline: bson.A{bson.D{{"$unwind", "$$s"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", "$$s"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SystemVariable": { - pipeline: bson.A{bson.D{{"$unwind", "$$NOW"}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", "$$NOW"}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Empty": { - pipeline: bson.A{bson.D{{"$unwind", ""}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", ""}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Number": { - pipeline: bson.A{bson.D{{"$unwind", 42}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", 42}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Array": { - pipeline: bson.A{bson.D{{"$unwind", bson.A{"$v"}}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$unwind", bson.A{"$v"}}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1532,63 +1678,73 @@ func TestAggregateCompatSkip(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "Document": { - pipeline: bson.A{bson.D{{"$skip", bson.D{}}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$skip", bson.D{}}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Zero": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", int32(0)}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "One": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", int32(1)}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SkipAll": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", int32(1000)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "StringInt": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", "1"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NegativeValue": { - pipeline: bson.A{bson.D{{"$skip", int32(-1)}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$skip", int32(-1)}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NegativeDouble": { - pipeline: bson.A{bson.D{{"$skip", -3.2}}}, - resultType: emptyResult, + pipeline: bson.A{bson.D{{"$skip", -3.2}}}, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", math.MaxInt64}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MinInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", math.MinInt64}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int64Overflow": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", float64(1 << 86)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "AfterMatch": { pipeline: bson.A{ @@ -1597,6 +1753,7 @@ func TestAggregateCompatSkip(t *testing.T) { bson.D{{"$skip", int32(1)}}, }, resultPushdown: true, // $match after $sort can be pushed down + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "BeforeMatch": { pipeline: bson.A{ @@ -1604,6 +1761,7 @@ func TestAggregateCompatSkip(t *testing.T) { bson.D{{"$skip", int32(1)}}, bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1619,58 +1777,67 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", "invalid"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ZeroOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", bson.D{}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TwoOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", bson.D{{"$type", "foo"}, {"$sum", 1}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DollarSignField": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"$v", 1}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include1Field": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", int32(1)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Exclude1Field": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", int64(0)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", 1.42}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Fields": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", 1.24}, {"bar", true}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Exclude2Fields": { pipeline: bson.A{ @@ -1678,6 +1845,7 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$project", bson.D{{"foo", int32(0)}, {"bar", false}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include1FieldExclude1Field": { pipeline: bson.A{ @@ -1685,7 +1853,8 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$project", bson.D{{"foo", int32(0)}, {"bar", true}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Exclude1FieldInclude1Field": { pipeline: bson.A{ @@ -1693,61 +1862,71 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$project", bson.D{{"foo", int32(1)}, {"bar", false}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeFieldExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}, {"v", true}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ExcludeFieldIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"v", false}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ExcludeFieldExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}, {"v", false}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeFieldIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"v", true}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign1Field": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", primitive.NewObjectID()}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "AssignID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", primitive.Binary{Subtype: 0x80, Data: []byte{42, 0, 13}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign1FieldIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"foo", primitive.NewDateTimeFromTime(time.Unix(0, 0))}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign2FieldsIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"foo", nil}, {"bar", "qux"}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign1FieldExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}, {"foo", primitive.Regex{Pattern: "^fo"}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationInclude": { pipeline: bson.A{ @@ -1756,6 +1935,7 @@ func TestAggregateCompatProject(t *testing.T) { {"v.foo", true}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationIncludeTwo": { pipeline: bson.A{ @@ -1765,6 +1945,7 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array", true}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationExclude": { pipeline: bson.A{ @@ -1773,6 +1954,7 @@ func TestAggregateCompatProject(t *testing.T) { {"v.foo", false}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationExcludeTwo": { pipeline: bson.A{ @@ -1782,6 +1964,7 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array", false}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationExcludeSecondLevel": { pipeline: bson.A{ @@ -1790,6 +1973,7 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array.42", false}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationIncludeExclude": { pipeline: bson.A{ @@ -1799,32 +1983,37 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array.42", false}, }}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", bson.D{}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Document": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", bson.D{{"v", "foo"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", bson.D{{"v", "foo"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDType": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", bson.D{{"$type", "$v"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DocumentAndValue": { pipeline: bson.A{ @@ -1834,50 +2023,58 @@ func TestAggregateCompatProject(t *testing.T) { {"v", 1}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Type": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "$v"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "$foo"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "$v.foo"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursive": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"$type", "$v"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"$non-existent", "$v"}}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveInvalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"v", "$v"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveArrayInvalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"$type", bson.A{"1", "2"}}}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeInt": { @@ -1885,68 +2082,79 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", int32(42)}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeLong": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", int64(42)}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeString": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "42"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"foo", "bar"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeEmpty": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeArraySingleItem": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.A{int32(42)}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.A{"foo", "bar"}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeNestedArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.A{bson.A{"foo", "bar"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeObjectID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", primitive.NewObjectID()}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeBool": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", true}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ProjectManyOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"$type", "foo"}, {"$op", "foo"}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SumValue": { pipeline: bson.A{ @@ -1954,6 +2162,7 @@ func TestAggregateCompatProject(t *testing.T) { {"sum", bson.D{{"$sum", "$v"}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1970,6 +2179,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", "$v"}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotation": { pipeline: bson.A{ @@ -1977,6 +2187,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", "$v.foo"}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayDotNotation": { pipeline: bson.A{ @@ -1984,6 +2195,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", "$v.0.foo"}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int": { pipeline: bson.A{ @@ -1991,6 +2203,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", int32(2)}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Long": { pipeline: bson.A{ @@ -1998,6 +2211,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", int64(3)}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Double": { pipeline: bson.A{ @@ -2005,6 +2219,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", float64(4)}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyString": { pipeline: bson.A{ @@ -2012,6 +2227,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", ""}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayEmptyVariable": { pipeline: bson.A{ @@ -2019,7 +2235,8 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$"}}}}, }}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValue": { pipeline: bson.A{ @@ -2027,6 +2244,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v"}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayTwoValues": { pipeline: bson.A{ @@ -2034,6 +2252,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", "$v"}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueInt": { pipeline: bson.A{ @@ -2041,6 +2260,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", int32(1)}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayIntLongDoubleStringBool": { pipeline: bson.A{ @@ -2048,6 +2268,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{int32(2), int64(3), float64(4), "not-expression", true}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveValue": { pipeline: bson.A{ @@ -2055,6 +2276,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sumsum", bson.D{{"$sum", bson.D{{"$sum", "$v"}}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveArrayValue": { pipeline: bson.A{ @@ -2062,6 +2284,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sumsum", bson.D{{"$sum", bson.D{{"$sum", bson.A{"$v"}}}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueRecursiveInt": { pipeline: bson.A{ @@ -2069,6 +2292,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", bson.D{{"$sum", int32(2)}}}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueAndRecursiveValue": { pipeline: bson.A{ @@ -2076,6 +2300,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", bson.D{{"$sum", "$v"}}}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueAndRecursiveArray": { pipeline: bson.A{ @@ -2083,6 +2308,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", bson.D{{"$sum", bson.A{"$v"}}}}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Type": { pipeline: bson.A{ @@ -2090,6 +2316,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sumtype", bson.D{{"$sum", bson.D{{"$type", "$v"}}}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveEmptyVariable": { pipeline: bson.A{ @@ -2097,7 +2324,8 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.D{{"$sum", "$$$"}}}}}, }}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MultipleRecursiveEmptyVariable": { pipeline: bson.A{ @@ -2105,7 +2333,8 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.D{{"$sum", bson.D{{"$sum", "$$$"}}}}}}}, }}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -2120,80 +2349,94 @@ func TestAggregateCompatAddFields(t *testing.T) { pipeline: bson.A{ bson.D{{"$addFields", "invalid"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeBool": { pipeline: bson.A{ bson.D{{"$addFields", false}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeArray": { pipeline: bson.A{ bson.D{{"$addFields", bson.A{}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeInt32": { pipeline: bson.A{ bson.D{{"$addFields", int32(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeInt64": { pipeline: bson.A{ bson.D{{"$addFields", int64(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeFloat32": { pipeline: bson.A{ bson.D{{"$addFields", float32(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeFloat64": { pipeline: bson.A{ bson.D{{"$addFields", float64(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeNull": { pipeline: bson.A{ bson.D{{"$addFields", nil}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include1Field": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", int32(1)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Fields": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField1", int32(1)}, {"newField2", int32(2)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Stages": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField1", int32(1)}}}}, bson.D{{"$addFields", bson.D{{"newField2", int32(2)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeDocument": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", bson.D{{"doc", int32(1)}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeNestedDocument": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", bson.D{{"doc", bson.D{{"nested", int32(1)}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeArray": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", bson.A{bson.D{{"elem", int32(1)}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "UnsupportedExpressionObject": { pipeline: bson.A{ @@ -2215,44 +2458,51 @@ func TestAggregateCompatAddFields(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"value", bson.D{{"$invalid-operator", "foo"}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Type": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "$v"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "$foo"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "$v.foo"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursive": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"$type", "$v"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"$non-existent", "$v"}}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveInvalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"v", "$v"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeInt": { @@ -2260,82 +2510,95 @@ func TestAggregateCompatAddFields(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", int32(42)}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeLong": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", int64(42)}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeString": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "42"}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"foo", "bar"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeEmpty": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MultipleOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "foo"}, {"$operator", "foo"}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MultipleOperatorFirst": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "foo"}, {"not-operator", "foo"}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MultipleOperatorLast": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"not-operator", "foo"}, {"$type", "foo"}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeArraySingleItem": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.A{int32(42)}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.A{"foo", "bar"}}}}}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeNestedArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.A{bson.A{"foo", "bar"}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeObjectID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", primitive.NewObjectID()}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeBool": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", true}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SumValue": { pipeline: bson.A{ @@ -2343,6 +2606,7 @@ func TestAggregateCompatAddFields(t *testing.T) { {"sum", bson.D{{"$sum", "$v"}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -2357,80 +2621,94 @@ func TestAggregateCompatSet(t *testing.T) { pipeline: bson.A{ bson.D{{"$set", "invalid"}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeBool": { pipeline: bson.A{ bson.D{{"$set", false}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeArray": { pipeline: bson.A{ bson.D{{"$set", bson.A{}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeInt32": { pipeline: bson.A{ bson.D{{"$set", int32(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeInt64": { pipeline: bson.A{ bson.D{{"$set", int64(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeFloat32": { pipeline: bson.A{ bson.D{{"$set", float32(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeFloat64": { pipeline: bson.A{ bson.D{{"$set", float64(1)}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeNull": { pipeline: bson.A{ bson.D{{"$set", nil}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include1Field": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", int32(1)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Fields": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField1", int32(1)}, {"newField2", int32(2)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Stages": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField1", int32(1)}}}}, bson.D{{"$set", bson.D{{"newField2", int32(2)}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeDocument": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", bson.D{{"doc", int32(1)}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeNestedDocument": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", bson.D{{"doc", bson.D{{"nested", int32(1)}}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeArray": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", bson.A{bson.D{{"elem", int32(1)}}}}}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "UnsupportedExpressionObject": { pipeline: bson.A{ @@ -2452,6 +2730,7 @@ func TestAggregateCompatSet(t *testing.T) { {"sum", bson.D{{"$sum", "$v"}}}, }}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } testAggregateStagesCompat(t, testCases) @@ -2465,68 +2744,80 @@ func TestAggregateCompatUnset(t *testing.T) { pipeline: bson.A{ bson.D{{"$unset", bson.A{1, 2, 3}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyArray": { pipeline: bson.A{ bson.D{{"$unset", bson.A{}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyString": { pipeline: bson.A{ bson.D{{"$unset", ""}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayWithEmptyString": { pipeline: bson.A{ bson.D{{"$unset", bson.A{""}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidTypeArrayWithDifferentTypes": { pipeline: bson.A{ bson.D{{"$unset", bson.A{"v", 42, false}}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "InvalidType": { pipeline: bson.A{ bson.D{{"$unset", false}}, }, - resultType: emptyResult, + resultType: emptyResult, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Unset1Field": { pipeline: bson.A{ bson.D{{"$unset", "v"}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "UnsetID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unset", "_id"}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Unset2Fields": { pipeline: bson.A{ bson.D{{"$unset", bson.A{"_id", "v"}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationUnset": { pipeline: bson.A{ bson.D{{"$unset", "v.foo"}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationUnsetTwo": { pipeline: bson.A{ bson.D{{"$unset", bson.A{"v.foo", "v.array"}}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationUnsetSecondLevel": { pipeline: bson.A{ bson.D{{"$unset", "v.array.42"}}, }, + failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } testAggregateStagesCompat(t, testCases)