title: Retrieve fields with space in the name through javascript
body: <p>I have a problem in retrieving fields stored in MongoDB using a javascript script.</p>
  
  <p>The db has been stored automatically after a web-crawl. Here's an example of an entry:</p>
  
  <pre><code>{
          "_id" : ObjectId("51ed0b2e12fd5629bf380355"),
          "title" : "Robert",
          "extraction" : {
                  "infobox" : [
                          {
                                  "given name" : {
                                          "region" : "Germanic",
                                          "articles" : "Robert",
                                          "pronunciation" : "{{IPAc-en|ˈ|r|ɒ|b|ər|t}}",
                                          "related names" : "Rob, Robbie, Robin, Rupert, Bob, Bobby, Bert, Rahbert",
                                          "name" : "Robert",
                                          "gender" : "Male",
                                          "meaning" : "\"fame-bright\""
                                  }
                          }
                  ]
          }
  }
  </code></pre>
  
  <p>I have to retry all the couples <em>title</em> - <em>related names</em>. I wrote this javascript:</p>
  
  <pre><code>db = connect("localhost:27017/Test");
  
  
  var nameCursor = db.Test.find({"extraction.infobox.given name.related names":{$exists:true}},{"title":1,"extraction.infobox.given name.related names":1});
  
  nameCursor.forEach(
    function(myDoc) {
        print(myDoc.title+" "+extraction.infobox.given name.related names );
    }
  );
  
  quit();
  </code></pre>
  
  <p>which of course is not working when it has to print because of the space in <code>given name</code> and <code>related names</code> fields. 
  Is there a way to escape the space, or at least to print the <em>infobox</em> json string, which I will eventually parse? </p>
  
  <p>Thanks in advance!</p>
  
  <p>P.S. I already know that next time I will have to substitute the space in the field keys with <code>_</code>. The extraction takes a long time, and now I quite in a hurry :)</p>
  
  <p><strong>Edit after Sammaye comment</strong></p>
  
  <p>Using <code>extraction.infobox['given name']['related names']</code>, it gives me the error </p>
  
  <pre><code> JavaScript execution failed: TypeError: Cannot read property 'related names' of undefined at names.js:L14
  </code></pre>
  
  <p>Of course, if I use <code>extraction.infobox['given name']</code> it prints </p>
  
  <pre><code>Robert undefined
  </code></pre>