title: How to convert JSON object structure to dot notation?
body: <p>I've got a variable I'm storing that will dictate what fields to exclude from a query:</p>
  
  <pre><code>excludeFields = {
    Contact: {
      Address: 0,
      Phone: 0
    }
  }
  </code></pre>
  
  <p>I need to convert this to a dot notation that will work with Mongo's <code>findOne</code>, e.g.:</p>
  
  <pre><code>things.findOne({}, {fields: {'Contact.Address': 0, 'Contact.Phone': 0}})
  </code></pre>
  
  <p>Just passing <code>excludeFields</code> does not work and results in an error, "Projection values should be one of 1, 0, true, or false"</p>
  
  <pre><code>things.findOne({}, {fields: excludeFields})
  </code></pre>
  
  <p>Do I have to write my own function to convert from hierarchical structure to flat dot notation? Or is there some mechanism to do this in JavaScript that I'm not aware of?</p>