Hi @Pavel_Duchovny,
Yes, all the code I used was based on the “Export to Language” feature, but the issue is that neither $regexMatch nor $regex is being recognised by the mongo driver inside $cond. This is the code of the specific pipeline stage with the issue:
bson.D{
{
Key: "$addFields",
Value: bson.D{
bson.E{
Key: "match_whole_name",
Value: bson.D{
{
Key: "$cond",
Value: bson.M{
"if": bson.D{
{
Key: "$regexMatch",
Value: bson.D{
{Key: "input", Value: "$name"},
{Key: "regex", Value: primitive.Regex{Pattern: "\bRonald\b"}},
{Key: "options", Value: "i"},
},
},
},
"then": 0,
"else": 1,
},
},
},
},
},
},
}
I raised a separate thread here about the regexMatch not recognised issue - it seems to be a bug / lack of support in the driver? If so, then I was wondering if I could use some workaround by setting a variable outside $cond and checking this with $eq inside the $cond?
Thanks,
George