SERVER-136262Open

Anchored $regex with a {0,n} quantifier on a literal (e.g. /^a{0,2}$/) gets index bounds that exclude zero-repetition matches -- indexed find() silently returns fewer documents

h3. Summary For a left-anchored \{{$regex}}, the planner derives a string prefix and scans only \{{\[prefix, prefix+1)}} in an ascending index. \{{analyze_regex::getRegexPrefixMatch()}} handles \{{*}} and \{{?}} correctly by dropping the preceding character from the prefix. It treats \{{\{}} like \{{+}} instead, ending the prefix but *keeping* the preceding character. \{{\{0,n\}}}, \{{\{0\}}} and \{{\{0,\}}} all make that character optional, so documents that match with zero repetitions fall

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix

No fix available yet.

Components
Server components related to this issue

No components specified.

Labels
Tags and classification
ca-assessmentqo-triage-week