Ticket: Principle of Least Privileges

created a user

  • username: mflixAppUser
  • password: mflixAppPwd
    and updated my connection srv
    MFLIX_DB_URI=mongodb+srv://mflixAppUser:mflixAppPwd@cluster0-jc5t6.mongodb.net/mflix
    restarted server. status code didnt turned up

Please share error messages.

APP is running without any error, but navigating to localhost:5000/status screen, status still red for this ticket

1 Like

I have the same situation, I created the new user, test connecting from mongo shell and everything works, but the app show the status in red yet.

I changed the user and password in the .env
I finished and restarted the app
Of course, there is no error in the terminal
I tried to run in a new incognito windows
I tried to run status page in other web browser

I’m Looking jet a solutions for this problem and I found it.

Just read and follow step by step the ticket! :smiley:

2 Likes

Tried changed several times and opened in incognito window. it didnt solved .
i didnt received status

Check and read the ticket carefully. Do what it says you have to do. Check your cluster user

I failed it to because I created new mongo db role but it is wrong.
Cluster -> Security -> Add New user and on the popup bottom you can find “Add Default Privileges” link

I hope it is help! :slight_smile:

Yes. Exactly like the task ask you to do:

This user should have the readWrite role on the mflix database. Use Add Default Privileges to assign the user this specific role.

I wonder what is difference if you create your custom role with similar permissions and assign to your user instead of “add default privileges”? will it be same result?

The difference is that the test will fail.

The test is very simple and is looking for specific information that just happens to be the result of exact instructions as given in the question. If you can follow instructions you get the question correct.

Well, it is obvious that test requires specific steps, but I am wondering from perspective of final result (not test and this cource specific). Probably will be same effect.

same problem here im dont know why!!! i have the add role custom and i try the default privileges… someting its wrong

MY URI:
MFLIX_DB_URI=mongodb+srv://mflixAppUser:mflixAppPwd@mflix-8ivbf.mongodb.net/mflix
i try the simple readWrite@mflix and nothings connect With Atlas Doest works and with readAnyDataBase@admin with atlas try to connect and does’nt work

I don’t know why anyone could still have the “same problem” when the instructions here have been so direct.

Granted there was a formatting problem in the post above, but the intention was not only to quote directly what is on the question page, but also to highlight in Bold the actual words that matter. ( well I just added the highlight on “this specific role”, but the rest was there )

Additionally directly above is the “I wonder what the different is…” comment with the response saying that the test will fail.

So to be clear:

  • Nothing in the question asked for a “custom role”.
  • The question actually names the “specific role” which you need to assign.
  • The question actually names the database to assign this role to
  • The question actually tells you the name of which “button” to press in the UI

SURE teh same…!!!
if you try to add the same default privileges

Severals attemps Laters Its works i don’t know WHY!!.. =(

and if you try connect atlas with that user not works… but in console its works with some problems… but works…

Remove the /mflix from the end of the URI. Again, none of the course instructions ever told you to do that.

On a MongoDB connection URI that “database” actually means the “database to authenticate with” as far as the NodeJS driver is concerned. When it is omitted completely or /test ( which is how the Altas UI delivers you the string ) it is ignored and the default "admin" namespace is used for authentication.

Legacy drivers use it for “default database” on connection, but all modern drivers have you “switch database” in your application code instead.

Thats i do… to works and may be thats its the problem with the atlas connections… not ocurs on the string console connection!!!

The directions are pretty specific and straightforward. I completed each step and read each response here but I am getting ‘MongoError: authentication fail’ when trying to connect with npm start.

I’ve got:

mflixAppUser; readWrite@mflix on Atlas,
MFLIX_DB_URI=mongodb+srv://mflixAppUser:mflixAppPwd@mflix … mongodb.net/ in .env (also tried hard coding into mongoClient.connect)

How can I troubleshoot?

Hi @Christy_07873

Is this a new error or where you able to resolve it (based on Getting MongoParseError: URI malformed when trying to run movie-last-updated-migration.js in Migrations Ticket) I think you might have but I want to confirm if this is still a problem for you ?

Kindest regards,
Eoin

@brazileoin This is a new error. I was able to resolve the previous errors and connections and tests were working well until I added the new user for the Principle of Least Privileges ticket. The ‘authentication fail’ for the readWrite user is still not resolved.