title: Synchronising Lodash and mongoose query in nodejs
body: <p>I am trying to accomplish synchronisation in Mongoose query inside a _.each lodash function like this - </p>
  
  <pre><code>            let commentContainer = [];
              let comments = {..} //json object having comments
               _.each(comments, comment =&gt; {
                  User.findOne({_id: comment.createdBy}).exec()
                  .then(function(commentor){
                      var c = {
                          text: comment.text,
                          votes: comment.votes.length,
                          commentor: {
                              name: commentor.name,
                              profilePhoto: commentor.profilePhoto,
                              id: commentor._id
  
                          }
                      }
                      commentContainer.push(c);
                  });
              });
              }
              console.log(commentContainer); //it shows []
  </code></pre>
  
  <p>How can I achieve it, I tried using setTimeout function by giving a delay but it does not seems a valid procedure.</p>