Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-7286

Comment on: "manual/reference/operator/query/regex.txt"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • None
    • None

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            xgen-internal-docs Docs Collector User (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 19 weeks ago