title: Find nested values in mongo 3 with java
body: <p>I have a document in my mongo collection that looks like this: </p>
  
  <pre><code>{ 
    "timestamp": 1460442540,
    "page": "home",
    "misc": {
               "color": "red",
               "light": "off" 
            }
  }
  </code></pre>
  
  <p>What I want to be able to do is return the value of <em>misc.color</em> when a certain condition is met on <em>page</em>.</p>
  
  <p>This is what I have:</p>
  
  <pre><code>   //find my query match
     Document value = mongoDBService.getCollection(collectionName)
              .find(eq("page", "home")).first();
  
      //prints json described above
      LOG.info(value.toString());
  
      //prints "misc" subdocument
      LOG.info(value.get("misc").toString());
  
      //null pointer
      LOG.info(value.get("misc.color").toString());
  </code></pre>
  
  <p>Is there some way to handle the dot notation here that I am missing? Ideally I want this query to be dynamic so it can handle dot notation values and higher level values.</p>
  
  <p>I am using mongodb-driver 3.4.2.</p>