Reputation: 630
https://spring.io/guides/gs/accessing-data-mongodb/ - The example does not show connecting to Mongo DB usage.
Upvotes: 2
Views: 552
Reputation: 1185
default spring data mongo db is connect your localhost if you not declare any connfiguration properties in applicaiton.properties
file
for example
launch mongodb server with mongod
command and after launch your application and make any CRUD
operation see log in your command prompt
if your application need special server uri or any configuration properties
add application.properties
file this properties and configure
for example
spring.data.mongodb.uri=mongodb://user:[email protected]:12345,mongo2.example.com:23456/test
this configure your uri with colleciton names
and also declare host and port with this
spring.data.mongodb.host=mongoserver
spring.data.mongodb.port=27017
and also more properties knowledges(for example: username and password settings) here: https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
connecting features here : http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-connecting-to-mongodb
Upvotes: 1