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

wildcardProjection not available for subtrees

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.2.1
    • Component/s: Index Maintenance
    • Query Optimization
    • ALL

      wildcardProjection does not work for wildcard indexes on a subtree. For example:

      Unable to find source-code formatter for language: mongodb. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      db.getCollection("companies").createIndex( { "representatives.$**" : 1 }, {wildcardProjection: {"representatives.niceNames": 0}} );

       Gives the error:

      {
       "ok" : 0.0,
       "errmsg" : "The field 'wildcardProjection' is only allowed when 'key' is {\"$**\": ±1}",
       "code" : 9,
       "codeName" : "FailedToParse"
      }

      Since the doc does not mention any such restriction, I am assuming it's a bug.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            eliott.coyac@gmail.com Eliott Coyac
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: