Skip to content

Commit ffd8e5c

Browse files
committed
the fix
1 parent bfc46eb commit ffd8e5c

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

internal/verifier/migration_verifier.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -905,12 +905,10 @@ func (verifier *Verifier) doIndexSpecsMatch(ctx context.Context, srcSpec bson.Ra
905905
ctx,
906906
mongo.Pipeline{
907907
{{"$documents", []bson.D{
908-
{{"spec", srcSpec}},
909-
}}},
910-
911-
// Add the destination spec.
912-
{{"$addFields", bson.D{
913-
{"dstSpec", dstSpec},
908+
{
909+
{"spec", bson.D{{"$literal", srcSpec}}},
910+
{"dstSpec", bson.D{{"$literal", dstSpec}}},
911+
},
914912
}}},
915913

916914
{{"$unset", lo.Reduce(

internal/verifier/migration_verifier_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,19 @@ func (suite *IntegrationTestSuite) TestVerifierCompareIndexSpecs() {
10201020
shouldMatch: true,
10211021
},
10221022

1023+
{
1024+
label: "simple deep",
1025+
src: bson.D{
1026+
{"name", "testIndex"},
1027+
{"key", bson.M{"$foo.bar": 123}},
1028+
},
1029+
dst: bson.D{
1030+
{"name", "testIndex"},
1031+
{"key", bson.M{"$foo.bar": 123}},
1032+
},
1033+
shouldMatch: true,
1034+
},
1035+
10231036
{
10241037
label: "ignore `ns` field",
10251038
src: bson.D{

0 commit comments

Comments
 (0)