We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

ODM LIKE

How to use :

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

I tried this:

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

more still fails



34.6k
Accepted
answer

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

thank

Solution

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