Home > Blockchain >  Can't connect MongoDB Atlas cluster to a Spring boot app
Can't connect MongoDB Atlas cluster to a Spring boot app

Time:11-19

When trying to just make sure the connect is working, this error arises.

Error that pops up

This is the connect string, Connection string

This is my aapp.properties,

spring.data.mongodb.uri=mongodb srv://jamescervamtes:[email protected]/TheShop
spring.data.mongodb.database=TheShop

I tried everything, and I am just expecting for the app to bee runnning showing me the connect to mongo is made and successful

EDIT:

This is the atlas UI

Atlas Ui

CodePudding user response:

Your connection URL isn't the same as what is listed in the atlas console.

Try setting your properties to this:

spring:
  data:
    mongodb:
      uri: mongodb srv://theshop.rmeawrn.mongodb.net/?retryWrites=true&w=majority
      username: <username>
      password: <password>
      database: TheShop

Also, I don't see anywhere in the atlas connection string that references the database. Are you certain that the database (TheShop) exists on this atlas cluster?

  • Related