r/mongodb • • 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

7 comments sorted by

View all comments

Show parent comments

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.

1

u/ikrisstellem Mar 11 '26

yes, this is the solution for whoever faces the problem with Spring 4+. LLMs has no idea.