Can't create a collection on mongo database

117 Views Asked by At

I am trying to create a collection in a mongo database through mongoDB compass. However, I get an error that says it is not authorized on the database to execute the command.

As well as this, when i do show dbs in the mongo shell I can only see one of the databases I have created (I can't even see admin, config or local), whereas I can see all of them in mongoDB compass. If I then try to create the data base in the mongo shell, i.e

use [database name]

db.createUser({...})

I get an error like this uncaught exception: Error: couldn't add user: not authorized on [database name] to execute command

but if I use admin first then I get this error uncaught exception: Error: couldn't add user: logical sessions can't have multiple authenticated users

Using db.auth first works and returns, 1. But then the rest of the errors just appear when I try everything else.

Does anyone know what is going on here? My databases have nothing in them and I don't know how to fix this

0

There are 0 best solutions below