Details
-
Bug
-
Resolution: Won't Fix
-
Minor - P4
-
None
-
Windows Server
*Location*: https://docs.mongodb.org/v3.0/reference/operator/query/regex/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36
*Referrer*: https://www.google.com/
*Screen Resolution*: 1440 x 900
*repo*: docs
*source*: reference/operator/query/regex
Windows Server *Location*: https://docs.mongodb.org/v3.0/reference/operator/query/regex/ *User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 *Referrer*: https://www.google.com/ *Screen Resolution*: 1440 x 900 *repo*: docs *source*: reference/operator/query/regex
-
0.25
Description
The page describes a prefix expression and separately explains a case-insensitive match but does not explain how the latter affects the former.
I think the prefix expression explanation should also state that using a case insensitive match will prevent a prefix expression from being optimized. A full index scan results in this case not one bounded by the prefix.
Separately it seems MongoDB could optimize the case-insensitive search for a prefix expression by simply restricting the search to two ranges: one starting with a lower-cased initial character and the other starting with an upper-cased initial character from the prefix. That would, on average be 26x faster than what happens today.