Hi guys this is my first question!
I'm learning MongoDB and I wanted to ask you about the difference between the following three approaches to filter documents within a collection:
Reg. Exp.
Plant
.find( { effects: /.*(hallucinogenic|sedating).*/ } )
comparison operator in
Plant
.find( { effects: { $in: [ 'hallucinogenic', 'sedating' ] } } )
logical operator OR
Plant
.find()
.or( [ { effects: 'hallucinogenic' }, { effects: 'sedating' } ] )
Are these approaches just personal preference choice or are they different in some term?
My personal preference is to use a Regular Expression, is there any drawback to that approach?