Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Created by Guest
Created on Nov 23, 2020

URI validation

I was building the URI in a spring configuration file as spring.data.mongodb.uri=${MONGODB_URI}/test?retryWrites=true&w=majority where MONGODB_URI came from a kubernetes secret (as it contains user & password) somehow a new-line had slipped into the kubernetes secret, so the query was effectively asking for "fpos-dev-pl-1.kqybg.mongodb.net\n" Besides learning how to correctly configure secrets, I learned in the process that neither Spring nor mongo was validating that spring.data.mongodb.uri was a well-formed URI and the application failed to start with error messages relating to not finding DNS and not being able to resolve the TXT record. This was very confusing. The driver should accept a URI parameter (instead of a String) and ensures that it is valid.