Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-59757

Evaluate supporting queries with match expressions on empty field names in SBE

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:
      None

      Description

      There are queries in mongo that are valid which match on an empty field name (""). That means that documents such as these will be returned

      {"": 1} 

      Initially it was brought to our attention that SBE does not support this, and we found the reason was that we have to treat empty strings in a special way when generating nested traversals in SBE. The way recursive path traversal is implemented in SBE, if we wanted to start supporting a query like this, we would have to remove the special meaning an empty string has in $elemMatch (https://github.com/mongodb/mongo/blob/8179692b362d8237f201719946eb46bac6a5e961/src/mongo/db/matcher/expression_parser.cpp#L1276), because otherwise the SBE traversal code cannot tell if an empty string is coming from this parser code or if the empty string is actually something that we are trying to match against. The correct solution would be to refactor the code that makes an empty string have a special meaning and instead perhaps use boost::optional, but that is a massive change that is very invasive since every match expression expects a StringData and not an optional.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-execution Backlog - Query Execution
              Reporter:
              andrii.dobroshynski Andrii Dobroshynski
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: