Learning Activity: Creating New Roles. Yet again

Hi,
this issue has already been raised here:

this topic is closed already,
but I’m getting the same weird error too though I’m pretty sure that my solution is correct.
Here is my solution:


and here is the output of online IDE:

Am I the idiot here or someone else?

From the first line we see in your terminal, I suspect that the previous command failed with some error. And the output of getRoles() does not seem to match what your createRole() is supposed to do.

It looks like createRole() was called once with wrong parameters and then a second time with the parameters you shared but failed with an error like role already exists.

My suggestion is that you first https://docs.mongodb.com/manual/reference/method/db.dropRole/ the role you created and then redo createRole().

Please post screenshot of both commands.

1 Like