title: How do I store a mongodb query result in a variable?
body: <p>I am having the hardest time finding a solution to something that should be so simple.. I would like to find a document in a mongo database and store it in a variable that i can use anywhere in a node.js app..</p>
  
  <p>The closest I think I have gotten is</p>
  
  <pre><code>var path = db.collection('paths').find().toArray()
  </code></pre>
  
  <p>where path is a collection holding one document, but then <code>console.log(path[0])</code> returns undefined..</p>