Query parser should reject $text predicate in $elemMatch

XMLWordPrintableJSON

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

      The query parser should disallow use of $text inside $elemMatch. There is no functionality to match a $text predicate against a subdocument; $text predicates apply to the root of a document only.

      Users receive the following cryptic error message when running an $elemMatch query that contains $text:

      > db.foo.find({a:{$elemMatch:{b:1,$text:{$search:"hello"}}}})
      error: {
      	"$err" : "Unable to execute query: error processing query: ns=test.foo limit=0 skip=0\nTree: a $elemMatch (obj)\n    $and\n        b == 1.0\n        TEXT : query=hello, language=, tag=NULL\nSort: {}\nProj: {}\n planner returned error: failed to use text index to satisfy $text query (if text index is compound, are equality predicates given for all prefix fields?)",
      	"code" : 17007
      }
      

              Assignee:
              Unassigned
              Reporter:
              J Rassi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: