function destroySession(clientToken, callback) {
  SessionMongoModel.findOneAndRemove({ token: clientToken },
    function(err, session) {
      if (err) {

        // TODO: Error message?
        callback(err, null);
      } else if (!session) {
        callback({
          code    : 400,
          message : 'Session not found.'
        });
      } else {
        callback(null);
      }
    }
  );
}
// Takes a token string and deletes the session with that string from MongoDB
Takes a token string and deletes the session with that string from MongoDB
Takes a token string and deletes the session with that string from MongoDB
function destroySession(clientToken, callback) {
  SessionMongoModel.findOneAndRemove({ token: clientToken },
    function(err, session) {
      if (err) {
        callback(err, null);
      } else if (!session) {
        callback({
          code    : 400,
          message : 'Session not found.'
        });
      } else {
        callback(null);
      }
    }
  );
}
function destroySession ( clientToken , callback ) { SessionMongoModel . findOneAndRemove ( { token : clientToken } , function ( err , session ) { if ( err ) { callback ( err , null ) ; } else if ( ! session ) { callback ( { code : 400 , message : 'Session not found.' } ) ; } else { callback ( null ) ; } } ) ; }
Takes a token string and deletes the session with that string from MongoDB
Takes a token string and deletes the session with that string from MongoDB
// TODO: Error message?