I thought for any connections, client must provide a set of username and password. And then I tried to connect MongoDB with DataGrip 2023.1.1 without any username and password, it makes me surprise because the tool still can connect with MongoDB. Did something go wrong? I tried with MongoDB Compass then I can’t access like what I expected. Last try, I connect with mongosh, the shell still make connection successfully.
If you just connect, it will work because there are some basic operations that are unauthenticated, e.g. the hello command that you can try in mongosh with the db.hello() helper.
However, as soon as you start doing something that requires auth, you will get an error. For example, in mongosh something as simple as show collections will fail with an error:
When Compass connects it does a bunch of thing, e.g. calling hostInfo, listing databases and collections, etc. that require auth and that is the reason why it fails.
I don’t know exactly you DataGrip works, but it’s possible that it just establishes the connection and waits idly until there is some user action that needs to trigger an authenticated command.