Regex case insensitive using Atlas Search

Hi,
im trying to use regex using case insensitive but can’t figure out how to use it,
this is my currently aggregation:

use("Marketplace")

db.Users.aggregate([
  {
    "$search": {
      "regex": {
        "path": "Name",
        "query": "carl",
        "allowAnalyzedField": true
      }
    }
  }
])

I want to get results like Carl, carl, CARL

@Henrique_Shoji - what is the analyzer you’re using for the Name field? If the analyzer does not lowercase, then queries are case sensitive. Perhaps you’re using lucene.keyword? Try lucene.standard and see if that helps.

It worked, thanks for the help!!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.