$all with empty operand never matches any documents

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The documentation for $all says:

       

      The $all operator selects the documents where the value of a field is an array that contains all the specified elements. 

      In the case of find({foo: {$all: []}}), there are no specified elements, which means that by this definition should match all documents where foo is an array (see SERVER-99070 for cases where the array clause is misleading). However, the current implementation will parse this query as $alwaysFalse.

       

      To improve the situation, the implementation should either:

      1. Parse to $alwaysTrue and update the docs to remove the array clause
      2. Match all documents where foo is an array
      3. Become a parse-time error similar to {$and: []}

              Assignee:
              Katya Kamenieva
              Reporter:
              Ben Shteinfeld
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: