There is an array field like this a = [‘128jin Lu’,’ gong kang’,’ Peng pu’]
I want to search this way: db.shanghai.find({a: /ong/})
I directly index A, the search speed is not as fast as not adding it. Why
Regular expressions are just like those in SQL
LIKE
Similarly, unless the left side is fixed ({a: /^ong/}
Otherwise, the index cannot be used.
Currently, MongoDB and general relational databases do not support such partial matching algorithms. ElasticSearch seems to have relevant support. However, it should be understood that this is a space-for-time approach, which may consume a lot of space. It is really necessary to ask questions in relevant sections.