I have two fields that I should match with simple text.
I'm currently using Jenssegers'Laravel Mongodb (https://github.com/jenssegers/laravel-mongodb)
The code right now is like this, and works almost as like I want:
$nameFilter = [[ 
    '$match' => 
    [
        '$or' =>
        [ 
            [ 
                'content.itemList.name' => ['$regex' => new Regex($request->q, 'i')] 
            ],
            [ 
                'content.itemList.commonName' => ['$regex' => new Regex($request->q, 'i')] 
            ]
        ]
    ]
]];
What's missing is that I want to ignore accents in the fields name and commonName, so for example if content.itemList.name is "foöBàr" and the query is "obar" I should get it in the results.
Edit: after days of trying I haven't found a solution yet.
Something so trivial I suppose should be easily done in MongoDB.
Other things I've tried:
- Created a text index for the fields I want to search
 - Use collation, which apparently doesn't work with Regex
 
Example documents
{
    lastname: "Mbappé",
    firstname: "Kylian",
    name: "Kylian Mbappé"
    otherfields: 123
}
What I want:
A query that matches any of lastname, firstname, or name with partial string (lian, appe, mbappe, etc.) both case-insensitive and diacritic (accent) insensitive.
Good matches should be, for example: "Mbappe" "appe" "mbappé" "Kylian" "kylian mbappe"