uri needs to start with mongodb // mongodb+srv java code example Example: mongodb local connection string mongodb://localhost:27017/mydbname