How can I search for a document whom a field contains a regex matches with the query?

147 Views Asked by At

I have a collection of documents with a field called "idPattern" containing regex string. I want to search all documents that their fields "idPattern" regex string matches with my search string or a substring of it. How can I perform it?

Example:

Document:

{
"_id":....,
"_rev":....,
"idPattern":"*"
},
{
"_id":....,
"_rev":....,
"idPattern":"park"
},
{
"_id":....,
"_rev":....,
"idPattern":"stree*"
}

Search by: "park_central"

The first two documents should be returned.

Thank you.

0

There are 0 best solutions below