On Dec 13, 9:48 am, AD7six <andydawso...@gmail.com> wrote:
> On Dec 10, 7:54 pm, RhythmicDevil <rhythmicde...@gmail.com> wrote:
>
> > I have been going around and around with this this morning trying to
> > sort out the correct syntax for an $or containing multiple $regex
>
> > So in RockMongo I use this:
>
> > {
> > "$or" : [
> >         {"ingredient" : {"$regex" : /^aru/i}},
> >         {"ingredient" : {"$regex" : /^bro/i}},
> >         ]
>
> why would you use 2 regexes for that /^(aru|bro)/i is the same thing

also - don't needlessly use the $regex key - that's probably your
error. You are _probably_ (who knows because you haven't shown the
executed query - I hope you've at least looked at it) generating
array('$regex' => array('$regex' => ...

{ingredient :  /^(aru|bro)/i} is all you need for the example yo'uve
shown

AD
>
> AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to