Case insensitive query Regex (startsWith)

Hi @Johannes_B,

One of the possible solutions to your problem is a use of a text index in a combination of an additional $and expression.

There are two possible ways to write this query once you indexed the field:

  1. Using the aggregation command you have 2 stages where first run the $search insesetive on the term “christiansen”, followed by a second $match on {"name.family" : /^christiansen/}.
  2. Use a find and do a $search with a $and on{"name.family" : /^christiansen/} .

This combination solve the insesetive search and the startWith in 2 efforts

Let me know if that helps.

Pavel