title: My return result from Promise is <pending>
body: <p>I'm using <code>Sequelize</code> database <code>orm</code> and by this code as </p>
  
  <pre><code>model.create(
      {
          username: 'John'
      } ).then( function (result) {
      return result.userUniqueId;
  } );
  </code></pre>
  
  <p>I can create new user in database and i can print <code>userUniqueId</code> inside of <code>then()</code>.</p>
  
  <p>after create user I want to use returned <code>userUniqueId</code> in other functions or only print that on console, but i can't return <code>result.userUniqueId</code> from that, for resolve this problem I'm trying to use <code>Promise</code> to get result then I deployed that to:</p>
  
  <pre><code>'use strict';
  
  module.exports = {
      createNewUser: function (model) {
          return new Promise(
              function (resolve, reject) {
                  model.create(
                      {
                          username: 'John'
                      } ).then( function (result) {
                      return result.userUniqueId;
                  } );
              } )
              .then( function (result) {
                  resolve( result.userUniqueId );
              } );
      },
  };
  </code></pre>
  
  <p>but i get this result outside of <code>createNewUser</code> function as <code>console.log( controller.createNewUser( models.users ) );</code></p>
  
  <p>Result:</p>
  
  <pre><code>Promise { &lt;pending&gt; }
  </code></pre>
  
  <p>How can i resolve this problem?</p>
  
  <h1>UPDATE:</h1>
  
  <pre><code>'use strict';
  
  module.exports = {
      createNewUser: function (model) {
          return new Promise((resolve, reject) =&gt; {
              return model.create(
                  {
                      username: 'John'
                  })
                  .then(function (result) {
                      return result.userUniqueId;
                  })
                  .then(value =&gt; resolve(value));
          });
      },
  };
  </code></pre>
  
  <p>and </p>
  
  <pre><code>var userId = controller.createNewUser(models.users)
          .then(function (userId) {
              return userId;
          });
  
  console.log(userId);
  </code></pre>
  
  <p>print Promise object</p>