Hi
The error:
Error: couldn’t add user: not authorized on admin to execute command
means that the current user you’re logged in as is not allowed to execute the createUser
command.
However, since it appears that you did not provide any credentials when connecting to MongoDB, and it appears that the localhost exception is not active, it is likely that there is an existing user already defined in your deployment (otherwise the createUser
command would succeed). Did you create this deployment yourself? If yes, did you follow the procedure outlined in https://docs.mongodb.com/manual/tutorial/enable-authentication/ ?
Best regards
Kevin