Reserved characters can be used in MongoRegx in the way.
/.*BS/(Hons/).*/i
the Query will be like this
$q->addOr($q->expr()->field($field)->equals(new \MongoRegex('/.*BS/(Hons/).*/i')));
Вопрос
i'm doing search with ZF2 Doctrine2 ODM and using MongoRegix but the problem is that i'm not able to search those terms which contains brackets like BS(Hons) is not searchable. my query is
$q->addOr($q->expr()->field($columns[$i]['field'])->equals(new \MongoRegex('/.*BS(Hons).*/i')));
any suggestion?
Решение
Reserved characters can be used in MongoRegx in the way.
/.*BS/(Hons/).*/i
the Query will be like this
$q->addOr($q->expr()->field($field)->equals(new \MongoRegex('/.*BS/(Hons/).*/i')));