Like queries in MongoDb Using PHP

Viewed 38

I want to use like queries for search in my app using MongoDb With PHP but I did not get the proper result.

Code:

$query = array("first_name" => "/.*a.*/" );
$updateResult = $this->dbCustomer->find($query);
2 Answers

I got an answer and I try this and it's work perfect :

$query = array(array("first_name" => new MongoDB\BSON\Regex("$search_text", 'i')))

Related