U kunt de extra zoekopdracht vermijden door iets te doen als:
WriteResult result = mongoTemplate.updateFirst(new Query(Criteria.where("_id").is(s)), new Update().inc("logincount", 1), User.class);
if (result.getN() != 1) {
throw new UsernameNotFoundException("user " + s + " does not exist");
}