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