Database

[{"name":"John Doe","matchingWords":["john doe","another string"]}]

Query

db.collection.find({$expr:{$anyElementTrue:{"$let":{"vars":{"searchString":"*** test text before string *** john doe | test string after string"},"in":{"$map":{"input":"$matchingWords","as":"mw","in":{"$ne":[-1,{"$indexOfCP":["$$searchString","$$mw"]}]}}}}}}})

Result