title: How to create URL for every MongoDB document
body: <p>I'm trying to map a URL using express routes to a specific value from every document I have in the database.</p>
  
  <p>For example. In the Schema company.name would return a company name.</p>
  
  <p>Is there a way to set the value of company.name to a unique URL? </p>
  
  <p>The only way I thought of it was creating a loop or using mongoose's .find to iterate through the database and set it to </p>
  
  <pre><code>app.get('/' + name , function (req , res ) {
     res.render('company.jade');
  });
  </code></pre>
  
  <p>However I'm not sure how to access the database collections from the routes file.</p>
  
  <p>Using</p>
  
  <pre><code>const Company = require('.models/company');
  </code></pre>
  
  <p>Doesn't return the database so not sure what to do.</p>
  
  <p>I'm not really hip on Mongoose or node.js yet. Really only need to do this one thing and the rest of the app is done in angular which I'm more familiar with.</p>
  
  <p>Hopefully I made some sense here. I do have code for the app buts it's all basic code from app.js and routes.js. I can add it if it would be helpful.</p>