MongoDB queries using like and disregarding accents and case

0

I would like to know how I can perform queries in mongodb when I can refer to any position in the string (Like) but it would also be necessary to disregard special characters such as accents.

I was able to disregard the special characters in the queries, but it does not search for parts of a string. Any suggestions on how to do such a consultation?

db.pessoas.find({$text:{$search:"jose"})

Result obtained

But I wanted to get the name Jose containing the jose     

asked by anonymous 30.09.2017 / 21:09

1 answer

-1

You can use regex to search:

db.getCollection('pessoas').find({ nome: { $in: [ /^Jos/i, /^é/ ] } } )
    
01.10.2017 / 01:59