Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

ODM LIKE

How to use :

db.collection.find( { user_id: /bc/ } )

I tried this:

Model::find( array('conditions' => array('param' => '/value/') ) )

more still fails



33.7k
Accepted
answer

A regular expression /bc/ in javascript is not the same as a string in PHP '/value/'. You have to use http://php.net/manual/en/class.mongoregex.php

thank

Solution

Model::find( array('conditions' => array('param' => new MongoRegex("/value/") ) ) )