0
votes

This is frustrating. Spent some good hours, but still can't figure it out. Really needing help now.

The issue is. I can access the local db (single) on my Mac Catalia OS, via Roto 3T with user/pwd, but I can't via iTerm2 zsh CLI. I uninstalled and re-installed mongoDB Community Edition 4.4, via brew services (brew install mongodb-community@4.4), still not working. I've been searching online and tried different things, like adding -p pwd, removing --authenticationMechanism, still no luck.

Here is the error message I keep getting. I already modified the /usr/local/etc/mongod.conf to enable authentication. /usr/local/var/mongodb folder exists with files in it. I verified that testuser was successfully created for mongoDB's testdb database, when I disabled the authentication and logged into mongoDB. Of course, since I can log in via Robo 3T, with the same user/pwd, that proves that testuser does exist in mongoDB.

Can you please help? Much thanks in advance!

~ > brew services start mongodb-community@4.4 7s 07:43:35 PM ==> Successfully started mongodb-community (label: homebrew.mxcl.mongodb-community)

~ > mongo —u testuser --authenticationDatabase testdb --authenticationMechanism SCRAM-SHA-256

MongoDB shell version v4.4.1 connecting to: mongodb://127.0.0.1:27017/%E2%80%94u?authMechanism=SCRAM-SHA-256&authSource=testdb&compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("7f5208cf-a7e5-464c-98ea-e553e4bca6dd") } MongoDB server version: 4.4.1

{"t":{"$date":"2020-11-01T00:13:54.378Z"},"s":"E", "c":"-", "id":22779, "ctx":"main","msg":"file [{filename}] doesn't exist","attr":{"filename":"testuser"}}

failed to load: testuser

exiting with code -3

1

1 Answers

0
votes

Dang, so happy to find out why. So, turns out that, after I inserted one document into the testdb, I can now log in mongoDB via CLI as well.

Not sure why it has this restriction for cli, but not for Robo 3T. Kind of studid, but so happy now!