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

Query parser should reject $text predicate in $elemMatch

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

      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 Unassigned
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: