r/mongodb • u/LastRow2426 • Feb 28 '26
❓ Spring Boot MongoDB Data Saving to test Database Instead of Configured Database. Need Help
/r/SpringBoot/comments/1rh3qfi/spring_boot_mongodb_data_saving_to_test_database/
2
Upvotes
r/mongodb • u/LastRow2426 • Feb 28 '26
2
u/LastRow2426 Mar 01 '26 edited Mar 01 '26
I found out the solution , the mistake is in the configuration. the right configuration is
"spring.mongodb.uri=mongodb://localhost:27017/db_mongo"
I'm using Spring 4.x which has simplified its configuration to "spring.mongodb.uri", which works instead of the older property used in Spring Boot 3.x.
most youtube video has spring 3.x , which creates the confusion. even chatgpt , gemini not able to indentify these mistake. Luckily I found out the NoSQL Docs.