i’m trying, to figure out how can i make this query work in mongodb.
This is the query i’m trying to do ( “translated” to mysql )
SELECT title FROM artists WHERE name LIKE "%a%" AND id NOT IN(1, 2)
The try in mongoDB
$term = new MongoRegex('/^a/i')l;
$not = array('$nin' => array('_id' => array('1', '2')));
$artists->find(array('name' => $term), $not);$artists->find(array('name' => $term, $not));
how can i make this work as expected, right now it returns null
Here is a solution for mongodb
just by writing each {} as an array, you will get the answer for php