title: Then executes before the query is done
body: <p>I had this issue yesterday, but instead to ask about this I asked for a solution so I didn't learn anything. I have code that looks like this: </p>
  
  <pre><code>User.findOne({'user.id': author.id}, 'id', function (err, userid) {
  
    console.log(userid); //(1) executes after (2)
    newCharacter.character.author = userid;
  
  }).then(() =&gt; {
  
    console.log('does it work? '+newCharacter.character.author); //(2) executes before (1): undefined
  
    newCharacter.save(function(err, character) {
      console.log('Success! ' +character.id);
    });
  });
  </code></pre>
  
  <p>When I log <code>userid</code> in <code>then</code> it is still undefined for some reason. Why is this happening? </p>