title: How do I access promise callback value outside of the function?
body: <p>It is to my understanding that callback functions are asynchronous and cannot return a value like regular functions. Upon reading about promises, I thought I grasped a good understanding about them, that they are basically an enhanced version of callbacks that allows returning a value like asynchronous function. In my <code>getConnections</code> method, I am attempting to call the <code>find()</code> function on my database through mongoose, and I am attempting to grab this array of objects and send it to the views. </p>
  
  <pre class="lang-js prettyprint-override"><code>var test =  new Promise((resolve, reject) =&gt; {
          Database.find().then(list =&gt; {
              resolve(list);
  
          }).catch(err=&gt; {
              return reject(err);
          })
  
          })
  console.log(test)
  </code></pre>
  
  <p>When I attempt to log to the console outside of the promise function, I get <code>Promise { _U: 0, _V: 0, _W: null, _X: null }</code></p>
  
  <p>I don't think this is functioning correctly, and I thought I utilized promises correctly. Could anyone point me in the right direction on how to return this array of objects outside of the callback function?</p>