Skip to content

Commit 30b9335

Browse files
committed
Fix migrator (tested locally)
1 parent adaafdb commit 30b9335

1 file changed

Lines changed: 38 additions & 26 deletions

File tree

src/Serval/src/Serval.Translation/Configuration/IMongoDataAccessConfiguratorExtensions.cs

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -72,37 +72,49 @@ await c.Aggregate()
7272
new BsonDocument(
7373
"targetQuoteConvention",
7474
new BsonDocument(
75-
"$first",
76-
new BsonDocument(
77-
"$map",
78-
new BsonDocument
79-
{
80-
{
81-
"input",
82-
new BsonDocument(
83-
"$filter",
84-
new BsonDocument
75+
"$ifNull",
76+
new BsonArray()
77+
{
78+
new BsonDocument(
79+
"$first",
80+
new BsonDocument(
81+
"$map",
82+
new BsonDocument
83+
{
8584
{
86-
{ "input", "$analysis" },
87-
{ "as", "a" },
88-
{
89-
"cond",
90-
new BsonDocument(
91-
"$ne",
92-
new BsonArray { "$$a.targetQuoteConvention", "" }
93-
)
94-
}
95-
}
96-
)
97-
},
98-
{ "as", "a" },
99-
{ "in", "$$a.targetQuoteConvention" }
100-
}
101-
)
85+
"input",
86+
new BsonDocument(
87+
"$filter",
88+
new BsonDocument
89+
{
90+
{ "input", "$analysis" },
91+
{ "as", "a" },
92+
{
93+
"cond",
94+
new BsonDocument(
95+
"$ne",
96+
new BsonArray
97+
{
98+
"$$a.targetQuoteConvention",
99+
""
100+
}
101+
)
102+
}
103+
}
104+
)
105+
},
106+
{ "as", "a" },
107+
{ "in", "$$a.targetQuoteConvention" }
108+
}
109+
)
110+
),
111+
""
112+
}
102113
)
103114
)
104115
)
105116
)
117+
.Merge(c, new MergeStageOptions<Build> { WhenMatched = MergeStageWhenMatched.Replace })
106118
.ToListAsync();
107119
}
108120
);

0 commit comments

Comments
 (0)