title: How to response data after create data "model.save()" in MongoDB?
body: <p>I try the response model after create data but it doesn't work. It shows data on "console.log" and it didn't respond when I use  "resolve({})". </p>
  
  <p>In the routers.js: </p>
  
  <pre><code>const register = require('./functions/register');
  module.exports = router =&gt; {
  
  router.get('/', (req, res) =&gt; res.end('Welcome to Idol Fan With your Idol !'));
  
  //======REGISTER &amp; LOGIN WITH SOCIAL =====
  router.post('/socialuser', (req, res) =&gt; {
      const social_id = req.body.social_id;
      const token = req.body.token;
      const name = req.body.name;
      const email = req.body.email;
      const photoprofile = req.body.photoprofile;
      const tokenfirebase = req.body.tokenfirebase;
  
      if (!social_id) {
  
          res.status(400).json({message: 'Invalid Request !'});
  
      } else {
  
          register.registerUser(social_id, name, email, photoprofile, token, tokenfirebase)
  
              .then(result =&gt; {
  
                  res.status(result.status).json({status: result.status, message: result.message, user: result.user})
              })
  
              .catch(err =&gt; res.status(err.status).json({message: err.message}));
      }
  });
  }
  </code></pre>
  
  <p>Function Register.js:</p>
  
  <pre><code>const userfan = require('../models/user');
  exports.registerUser = (social_id, name, email, photoprofile, token, 
  tokenfirebase) =&gt;
  
  new Promise((resolve, reject) =&gt; {
      const d = new Date();
      const timeStamp = d.getTime();
  
      userfan.find({social_id: social_id})
          .then(users =&gt; {
              if (users.length == 0) {
  
                  let newUser = new userfan({
                      social_id: social_id,
                      name: name,
                      email: email,
                      photoprofile: photoprofile,
                      token: token,
                      tokenfirebase: tokenfirebase,
                      created_at: timeStamp
                  });
  
                  newUser.save()
                      .then(doc =&gt; {
                          console.log("run... " + doc);
                          resolve({
                              status: 200,
                              message: 'User Register Sucessfully !',
                              user: doc
  
                          });
                      })
  
                      .catch(err =&gt; {
                          console.error(err)
                          if (err.code == 11000) {
  
                              reject({status: 409, message: 'User Already Registered !'});
  
                          } else {
  
                              reject({status: 500, message: 'Internal Server Error !'});
                          }
                      });
              } else {
                  return users[0];
              }
          })
          .then(usertemp =&gt; resolve({status: 200, message: "Login Successfully !", user: usertemp}))
  
          .catch(err =&gt; {
              console.log(err.message);
              reject({status: 500, message: err.message});
          });
  });
  </code></pre>
  
  <p>This is my result after run on server:
  <a href="https://i.stack.imgur.com/d5Amp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d5Amp.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/9MKvQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9MKvQ.png" alt="enter image description here"></a></p>
  
  <p>As a result and code above. I have a question Why "user: doc" no response?. Thank you so much!       </p>