title: Callback function does not return value
body: <p>I have this function, using MongooseJS, Node and JS: </p>
  
  <pre><code>module.exports.getNextSequence = function (sequenceName) {
  
      var query = { "_id": sequenceName };
      var update = { $inc: { seq: 1 } };
      var options = { new: true };
  
      this.sequence.findOneAndUpdate(query, update, options, function (err, nextNumber) {
          if (err) {
              console.log('got an error');
          };
  
          console.log(nextNumber._doc.seq);
          return nextNumber._doc.seq;
      });
  
  };
  </code></pre>
  
  <p>...and I'm invoking it as follows: </p>
  
  <pre><code>  var song = sequenceHandler.getNextSequence(CONST.SONG_NUMBER_SEQUENCE);
    var album = sequenceHandler.getNextSequence(CONST.ALBUM_NUMBER_SEQUENCE);
  </code></pre>
  
  <p>In debugging mode, everything works fine, but in running mode I've got an undefined value.</p>
  
  <p>What am I doing wrong?</p>