Add null check when checking for mongoose or promises