Have you run the db.createUser command that’s mentioned in the tutorial as a note in case you do get similar errors?
Yes, I tried this too. After starting the Mongo-Container I go to the terminal and do this:
Code:
root@mongo:/# mongo -u root -p 7vt4vg239w --authenticationDatabase admin
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/?authSource=admin&compressors=disabled&
gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("234dfd32-e9a7-471c-bb89-3b8b2d8e0c66")
}
MongoDB server version: 4.4.1
---
The server generated these startup warnings when booting:
2020-09-24T10:46:03.040+00:00: Using the XFS filesystem is strongly reco
mmended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/p
rodnotes-filesystem
---
---
Enable MongoDB's free cloud-based monitoring service, which will then re
ceive and display
metrics about your deployment (disk utilization, CPU, operation statisti
cs, etc).
The monitoring data will be available on a MongoDB website with a unique
URL accessible to you
and anyone you share the URL with. MongoDB may use this information to m
ake product
improvements and to suggest MongoDB products and deployment options to y
ou.
To enable free monitoring, run the following command: db.enableFreeMonit
oring()
To permanently disable this reminder, run the following command: db.disa
bleFreeMonitoring()
---
>
The command line is just >, nothing like
rs:PRIMARY
... But I'm sure I saw also rs:PRIMARY
or similar before... And now, when using the db.createUser command, I get this:
Code:
> db.createUser({user: "admin", pwd: "7vt4vg239w", roles: [{role: "readWrite", d
b: "db"}]})
uncaught exception: Error: couldn't add user: not master :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1361:11
@(shell):1:1
>
Arrgggh, I'm sure this worked before, but now I'm stucked here already... Why looks the command line so different?