👉 Your MongoDB COnfiguration file spring. data.MongoDB.authentication-database=admin
spring.data.mongodb.username=root spring.data.mongodb.password=root
You Can Use this Only Enough. This is for local server MongoDB
server.port=8023spring.data.mongodb.database=srecordspring.data.mongodb.port=27017spring.data.mongodb.host=localhost
This is for Remote Server Mongo DB Atlas cloud
server:
port: 8023
spring:
data:
mongodb:
database: test
uri: mongodb://prince:root@test-shard-00-00.cswuu.mongodb.net:27017,test-shard-00-01.cswuu.mongodb.net:27017,test-shard-00-02.cswuu.mongodb.net:27017/test?replicaSet=atlas-ofyv9a-shard-0&ssl=true&authSource=admin
#mongodb://prince:root@test-shard-00-00.cswuu.mongodb.net:27017,test-shard-00-01.cswuu.mongodb.net:27017,test-shard-00-02.cswuu.mongodb.net:27017/test?replicaSet=atlas-ofyv9a-shard-0&ssl=true&authSource=admin
server:port: 8023spring:data:mongodb:database: testuri: mongodb://prince:root@test-shard-00-00.cswuu.mongodb.net:27017,test-shard-00-01.cswuu.mongodb.net:27017,test-shard-00-02.cswuu.mongodb.net:27017/test?replicaSet=atlas-ofyv9a-shard-0&ssl=true&authSource=admin#mongodb://prince:root@test-shard-00-00.cswuu.mongodb.net:27017,test-shard-00-01.cswuu.mongodb.net:27017,test-shard-00-02.cswuu.mongodb.net:27017/test?replicaSet=atlas-ofyv9a-shard-0&ssl=true&authSource=admin
spring.data.mongodb.database=test_db spring.data.mongodb.port=27017 spring.data.mongodb.host=localhost
Comments
Post a Comment