fix mongo auth logic to work when auth is enabled