Bharat
Bharat

Reputation: 1082

Unable to connect mongodb atlas to intellij MongoExplorer

I'm using mongodb atlas for my backend and I'm trying to connect it to Mongo Explorer of intellij

This is the first image for furthur details

I have replaced the <PASSWORD> with actual database password

This is the second image where I provided the database username and password but still I'm not able to connect.

Error image

I have connected to localhost very easily without any problems but this is not connecting...

I'm using Intellij Idea Ultimate 2017.1.3 with student license. I think there is no problem with this particular license and Ide version

Thanks in advance :)

Upvotes: 5

Views: 2687

Answers (2)

mongodb+srv://admin:<password>@clust‌​er0-shard-00-01-shj3‌​q.mongodb.net/test?retryWrites=true

Upvotes: 0

It is very easy steps:

  1. Add these Dependencies in pom.xml file :

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    

  2. You want to add this code to application.properties file :

     spring.data.mongodb.uri= your_uri_here
     spring.data.mongodb.database= database_name_here
    

enter image description here

enter image description here

Upvotes: 2

Related Questions