Closed sunao-uehara closed 8 years ago
Yes, you can. your code should look something like...
col:find_one({name = {['$regex'] = 'Andrew', ['$options'] = 'i'}})
mongo-cli uses javascript, which has a regex type. Lua does not. Since JSON doesn't either, mongo's wire protocol represents regexes in the form above instead of the more terse /Andrew/i format.
...now that I think about it, I believe this format is documented in https://docs.mongodb.org/v3.0/reference/operator/query/regex/`
Thanks!! It works perfectly.
Is there any way to use $regex search with col:find() or col:find_one() ?
mongo cli supports regex search as below.
But it doesn't work, if I do like this with resty-mongol's col:find_one().