Regex flag /g not supported in aggregation on Serverless cluster?

Hi @John_Knoop,

Hmm, so the /g flag didn’t work before either, it just wasn’t reported?

Starting at version 4.4 onwards, the $regex operator does not support the global search modifier g as noted in the docs:

It was silently ignored in version 4.4 and 5.0 which is why no error is returned. As noted in my previous comment, starting in MongoDB Version 5.1, invalid $regex options are no longer ignored which resulted in the error you received when running the aggregation example you provided with the /g flag against a Serverless instance (which would have been MongoDB version 5.3 judging by the time of this post but correct me if i’m wrong here).

Regards,
Jason

2 Likes