title: how to query case insensitivity and contains with Spring MongoTemplate
body: <p>I have JSON documents in MongoDB like these</p>
  <pre><code>{
    &quot;os&quot; : &quot;Windows 10&quot;
  }
  
  {
    &quot;os&quot; : &quot;WINDOWS 8&quot;
  }
  
  {
    &quot;os&quot; : &quot;UBunTu 18.04&quot;
  }
  </code></pre>
  <p>how can I query on <code>os</code> with case insensitivity and contains using Spring MongoTemplate so that I can  pass <code>[&quot;windows&quot;, &quot;ubuntu&quot;]  </code> and get all three documents from DB</p>
  <p>I tried something like this but did not work.</p>
  <pre><code>String osRegEx = String.join(&quot; | &quot;, new String[]{&quot;windows&quot;, &quot;ubuntu&quot;});
  query.addCriteria(Criteria.where(&quot;os&quot;).regex(osRegEx, &quot;i&quot;));
  </code></pre>