Skip to content

Commit 58e5416

Browse files
committed
fix: migration -> think about a chance of null for array
1 parent 86fac8e commit 58e5416

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

server/internal/infrastructure/mongo/migration/250821145423_change_esri_and_stamen_to_default.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ func ChangeEsriAndStamenToDefault(ctx context.Context, c DBClient) error {
3333

3434
update := bson.M{
3535
"$set": bson.M{
36-
"items.$[].groups.$[].fields.$[f].value": "default",
36+
"items.$[i].groups.$[g].fields.$[f].value": "default",
3737
},
3838
}
3939
arrayFilters := options.ArrayFilters{
4040
Filters: []interface{}{
41+
bson.M{"i.groups": bson.M{"$type": "array"}},
42+
bson.M{"g.fields": bson.M{"$type": "array"}},
4143
bson.M{
4244
"f.field": "tile_type",
4345
"f.value": bson.M{

0 commit comments

Comments
 (0)