chrispytoes
chrispytoes

Reputation: 1889

"There are no users authenticated" even though authentication is disabled

I just downloaded the new MongoDB 4.2.1, on Windows, and I just want to use it locally without authentication. I am able to run mongod plain and the server starts fine. I am able to connect to mongodb://localhost:27017, but when I try to do anything I get the error there are no users authenticated.

I never had this issue in previous versions, so I'm wondering if 4.2 now has new restrictions that authentication must be enabled or something. Is that the case?

Edit: This is a new fresh install of MongoDB, and I've uninstalled all other versions. I haven't changed the config. All I have done is create the C:/data/db directory.

Edit 2:

Here is my config file:

storage:
  dbPath: C:\Program Files\MongoDB\Server\4.2\data
  journal:
    enabled: true
net:
  port: 27017
  bindIp: 127.0.0.1

Some more information from messing around. MongoDB Compass gives me the error immediately upon connecting. A nodejs application is able to connect but when attempting to write anything it gets the error.

However, in the mongo shell I am able to connect and make write operations with no issues.

There are no commands being logged, only the initial startup output which all seems normal.

db._adminCommand( {getCmdLineOpts: 1}) output:

{
        "argv" : [
                "C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.exe",
                "--config",
                "C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.cfg",
                "--service"
        ],
        "parsed" : {
                "config" : "C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.cfg",
                "net" : {
                        "bindIp" : "127.0.0.1",
                        "port" : 27017
                },
                "service" : true,
                "storage" : {
                        "dbPath" : "C:\\Program Files\\MongoDB\\Server\\4.2\\data",
                        "journal" : {
                                "enabled" : true
                        }
                },
                "systemLog" : {
                        "destination" : "file",
                        "logAppend" : true,
                        "path" : "C:\\Program Files\\MongoDB\\Server\\4.2\\log\\mongod.log"
                }
        },
        "ok" : 1
}

Upvotes: 1

Views: 2175

Answers (3)

Make sure you have installed mongodb

Upvotes: 0

chrispytoes
chrispytoes

Reputation: 1889

Well, for some reason it worked when connecting to 127.0.0.1 and not localhost. Never had that before.

Upvotes: 1

paulsm4
paulsm4

Reputation: 121649

I'm giving this as a "response" (instead of a "comment"), just so I can format things more clearly for you.

I happen to be running MongoDB 4.2.0 on a Linux VM, with no authentication ... and no problems.

SUGGESTIONS:

  1. Check /etc/mongod.conf (Windows equivalent), and make sure authorizationis COMPLETELY COMMENTED OUT (vs. "authorization: disabled")

  2. Check /var/log/mongodb/mongod.log (Windows equivalent). If you find anything "significant", please copy/paste it into your post.

  3. In "mongo", type db._adminCommand( {getCmdLineOpts: 1}) and ensure your runtime configuration settings match what you expect them to be.

Please keep us posted what you find!

Upvotes: 0

Related Questions