Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Looking to use $text and $search

I want to be able to search the comment column of my database. Usually there are a few words saved in the string.

I think that $text and $search will work, according to Mongo's docs. I just don't know how to put it together to make it work. I also do not want it to be case sensitive so I would also need $options, 'i' right?

How would I put the three of these together? Or is there a better way of doing it?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Looking to use $text and $search

Hello Ellen,

Appery.io doesn't support these parameters. Please use $regex for that: https://devcenter.appery.io/documenta...

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Looking to use $text and $search

So if I searched the word "little", it would find something that had "three little bunnies"? Do I need to use any $options or does $regex work in this way alone?

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Looking to use $text and $search

I tried $regex alone and I also tried it with $options "m" and "si" and in all of these examples, it would only match exact matches instead of ones that just contain the word.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Looking to use $text and $search

{"comment": {"$regex": value, "$options":"gi" } }

This seemed to work perfectly.

Return to “Issues”