Hello ,
I would like to introduce in the query field the like system as in the sql to be able to search for a telephone number starting with the middle example: +3367854456
my search is done like this: 67854456 without the telephone code
do you have any idea how to do it please?
Cordially.
Hi,
You can use $regex
operator:
db.collection.find({
"phone": {
"$regex": "67854456"
}
})
Hi NeNad ,
Thanx for your response but unfortunately I avoid the regex because it slows down the call to the api I would rather something like this :
{
autocomplete: {
query: `%${phoneSearch}%`,
path: 'phone',
},
},
if it exists ?
Cordialy
the response of my question → https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#std-label-bson-data-types-autocomplete
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.