I can't pass ConnectionTest

When I run:

mvn test -Dtest=ConnectionTest

the result is:

[ERROR] Failures:

[ERROR] ConnectionTest.testMoviesCount:44 Check your connection string expected:<45993> but was:<44993>

Whats is wrong?

did you change the connection string in spring.mongodb.uri to something like this:


this example is using Atlas and you should customize to your connection string.

1 Like

Thanks vssouza, but i get the same error.

Can’t you paste your connectionstring and replace the servername fix xxxx like I did? The problem is there and you just need to spot.

If you don’t feel comfortable to post it you can test the same connectionstring with compass and mongoshell to check if it works.

This is my application.properties:

I have replaced whit xxxx the server.

The test result says:
" expected: <45993> but was:<44993>"
And as for me the connection looks good, but you’ve lost 1000 movies somewhere…
I’d suggest you to open MongoDB Compass and check documents in movies collection:

If the documents in movies collection will not be 45993 try to repeat the step with “mongorestore”.

1 Like

Sorry but I’m working outdoors today and don’t have my laptop. I’m answering from my phone. The application properties seems ok to me. Maybe u can compare it with the application properties I have in my github

There is a repo named mflix. I replaced the server name with xxxxx too.

Can u compare and see if u find any differences??

I was checking the ConnectionTest class and the message u are getting is from a method that counts the movies:

@ViacheslavT pointed it right. U have the database… u have the collections but there are 1000 movies missing.

Did u get any errors during mongorestore process?? You can try to drop the database and mongorestore the dump again! That should be really fast and straight forward.


Thanks very much vssouza. Now works !!
I have drop the database, and restore it.

That’s really good to know man! :slight_smile: