Text Search with Regex Search

By reading the Text Search documentation (here) I understand that:

The $text operator expression cannot appear in $or or $not expressions.

But what if I would like to get everything that match a Text Search and also the documents that contains the string (something like: { name /mar/i } )?

I thought about an union but there are other criteria to duplicate and I really don’t want that.

Any suggestions?

Hi @Roberto_de_Oliveira,

I believe you can have an “or” like condition in the regex syntax looking for 2 types of strings.

If that won’t work consider maybe using the $facet search with 2 pipelines to define 2 searches.

In any case if you are using Atlas you should use Atlas search engine and indexes as a better solution for text search.

Thanks
Pavel