Not able to read from mflix.movies

Application is up and running properly but not able to retrieve the records from “mflix.movies”.

2019-01-10 10:38:06.176 INFO 20016 — [nio-5000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet ‘dispatcherServlet’
2019-01-10 10:38:06.176 INFO 20016 — [nio-5000-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet ‘dispatcherServlet’: initialization started
2019-01-10 10:38:06.248 INFO 20016 — [nio-5000-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet ‘dispatcherServlet’: initialization completed in 72 ms
2019-01-10 10:38:06.769 INFO 20016 — [nio-5000-exec-1] org.mongodb.driver.connection : Opened connection [connectionId{localValue:4, serverValue:6303}] to
2019-01-10 10:38:06.916 ERROR 20016 — [nio-5000-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path threw exception [Request processing failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 8000 and error message ‘user is not allowed to do action [find] on [mflix.movies]’ on server] with root cause

com.mongodb.MongoQueryException: Query failed with error code 8000 and error message ‘user is not allowed to do action [find] on [mflix.movies]’ on server
at com.mongodb.operation.FindOperation$ ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.operation.FindOperation$ ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.operation.OperationHelper.withConnectionSource( ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.operation.OperationHelper.withConnection( ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.operation.FindOperation.execute( ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.operation.FindOperation.execute( ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute( ~[mongodb-driver-sync-3.9.1.jar:na]
at com.mongodb.client.internal.MongoIterableImpl.execute( ~[mongodb-driver-sync-3.9.1.jar:na]
at com.mongodb.client.internal.MongoIterableImpl.iterator( ~[mongodb-driver-sync-3.9.1.jar:na]
at mflix.api.daos.MovieDao.getMovies( ~[classes/:na]

The same error happens with me too, also when I run the unit tests.

To fix the error, it’s necessary to configure your spring.mongodb.uri value like this:

“mongodb+srv://m220student:m220password@{ your host here}”

Hi @vensanravi,

@brunomathidios stands correct. Do not forget to set the "spring.mongodb.uri" in the file. Also, make sure that the Atlas cluster user created is correctly set with the ip whitelisting including your IP address.

We recommend, for this course purposes only, to allow connections from any address by setting the CIDR block “” in the ip whitelist.


1 Like

In the course they forgot to add the username and password for the property spring.mongodb.uri inside the

Your final spring.mongodb.uri like below.


1 Like

Thank you, adding user & password in uri helped! :smile:

Instructions definitely should be updated with this info

spring.mongodb.uri=mongodb://,, --ssl --authenticationDatabase admin --username m220student --password m220password

I am using this one since i have mongdb3.4.

Its still showing same error

Hi @Harsh3,

We always recommend to use the latest MongoDB version which is 4.0.10 (Enterprise). As there have been so many updates since 3.4 version and there might be some labs which you won’t be able to complete due to the same reason.

You can download it here.

Please let me know if you have any questions.