] SOLVED SOLUTION [
The tutorial I was following did not mention I needed to create a user “myUser” associate them with the database for example “bios” with a a password. Log out and then login to create the database and add collections to it.
Step one login using admin user:
mongo -u "mongoAdmin" -p "myPassword" --authenticationDatabase "admin"
Step two create the user for your desdired database:
db.createUser({
user: "myUser",
pwd: "anotherpassword",
roles: ["readWrite", "bios"]
})
Step three logout :
quit()
Step four login with the user.
mongo -u "myUser" -p "anotherpassword" --authenticationDatabase "bios"
5: Create database and add data for testing.
use bios
db.bios.insert({ x:1 })
db.bios.find()
Hope this help others.
Environment : Linux d64 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
MongoDB version : 4.2.23
Thanks