title: MongoDB search in nested documents with dynamic keys?
body: <p>I have a collection with documents like this:</p>
  
  <pre><code>{
    "_id": {
      "$oid": "582b5fdf09ecd804b275894c"
    },
    "scriptData": {
      "playerStats": {
        "582b5f9409ecd804b2752bc7": {
          "status": "closed",
          "tileSum": "0"
        },
        "582b6082d20c9404b29d4d6f": {
          "status": "closed",
          "tileSum": "16"
        }
      }
    },
    "startDate": {
      "$date": {
        "$numberLong": "1479237815109"
      }
    },
    "nextPlayer": "582b6082d20c9404b29d4d6f"
  }
  </code></pre>
  
  <p>What I am trying to accomplish is to find every document where tileSum is greater thank 200, but have not been successful. The keys in playerStats are dynamic. It is the players ID.</p>
  
  <p>I have tried like this:</p>
  
  <pre><code>db.collection.find({
         "scriptData":{
            "playerStats":{
               "tileSum":{
                  "$gt":200
               }
            }
         }
      })
  </code></pre>
  
  <p>But I get this error: The action could not be executed. Please check your parameters.</p>
  
  <p>I am not sure how to accomplish this and hoping for help...</p>
  
  <p>Thanks in advance :-)</p>