Example: query string= ‘question’, locale= 'en’
My conditions:
I would like to search in my specific locale
AND
Search in the title OR the description property (case insensitive and search or description includes my query string)
Hey @radikris! Since you’re looking for a regex inside of an array you’ll want to use the $regex and $elemMatch operators. Then your query would look like this to search for something in the title:
How can I pass the locale dynamically to this query, because this list is localized with builder, but I only want to search in the list[locale]. (see my example above)
You’re on the right track! Javascript does not allow template strings for property names. You can wrap it in brackets instead to make it a computed property. [`data.helplist.${locale}.$elemMatch`]
@radikris I wonder if the [data.helplist.${locale}.$elemMatch] isnt being calculated to what you expect? I would console log to make sure that is what you want it to be
okey, thanks for pointing this out for me, I realized it was not the issue with my querying, I had an extra filtering local, where I did not add the toLowerCase()
Thank you, sorry for this unneccessary question but hope someone else can learn from it