Details
-
Bug
-
Resolution: Won't Fix
-
Major - P3
-
None
-
None
-
windows 7 64-bit, mongodb 3.2, Intel i5 2.5GHz, 16GB ram
*Location*: https://docs.mongodb.org/manual/reference/operator/query/regex/
*User-Agent*: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36
*Referrer*: https://www.google.com/
*Screen Resolution*: 1920 x 1080
*repo*: docs
*source*: reference/operator/query/regex
windows 7 64-bit, mongodb 3.2, Intel i5 2.5GHz, 16GB ram *Location*: https://docs.mongodb.org/manual/reference/operator/query/regex/ *User-Agent*: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36 *Referrer*: https://www.google.com/ *Screen Resolution*: 1920 x 1080 *repo*: docs *source*: reference/operator/query/regex
Description
https://docs.mongodb.org/manual/reference/operator/query/regex/#index-use
This section describes how by using indexes properly and taking advantage of the ^ regex operator you could optimize the index results being read.
I'm seeing weird results when .explain() on a query and would like to know if this is typical for large databases.
I have a collection that is 1.5 million records and remains static and only needs to be used for reads.
i'm doing a text search and a regex search on it (seperately).
The field that i am executing the regex search on is a string, and i believe it to be primarily digits with an occasional dash ("-").
when i perform a regex /^term/ it reports that "keysExamined": 471 which makes sense here, but if i perform a case insensitive regex, it examines all 1.5 million records. example regex /^536/ , expected to match code: "5360172"
I wanted to see if this was a bug, I would expect that even if the index it looks through knows that there are only digits in the system that adding case insensitivity to the regex would not cause such drastically different results.