title: Dynamic scoping in Javascript similarly to Mongo
body: <p>I have been trying to wrap my head around Dynamic Scoping, I love that with MongoDB you have the option to scope with strings, for example (this is pseudo and has not been tested)</p>
  <pre class="lang-js prettyprint-override"><code>const data = Schema.find({&quot;scope.to.nested&quot;: &quot;hello&quot;})
  
  console.log(data)
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>&gt; [{scope: { to: {nested: &quot;hello&quot;}}}]
  </code></pre>
  <p>How would you accomplish the same thing in Javascript. Maybe something like</p>
  <pre><code>console.log(data[&quot;scope.to.nested&quot;])
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>&gt; &quot;hello&quot;
  </code></pre>
  <p>I have been trying to think of a way to ask this as clear as possible, so please ask for clarification if I am just pouring unfiltered thoughts onto the internet with no real coherent expectations </p>