I am trying to do a case insensitive search with name starting from "xxx". However it doesnt seems to work. Below is my code
$test = Test::find( array(
array( "name" => array( '$regex' => '/^'.$query.'/i' ) ),
"limit" => 5
) );
Is anything wrong with my query? appreciate any insights.