I have a node js program which uses mongodb as its dbs, which looks something like this:
show dbs
test
eas
use eas
show collections
nodeurls
nodes
users
At this stage, everyone can access mongo shell and look at all the collections and the data in them. However, I want to add in authentication, so that someone will first have to authenticate against the mongo shell, and then will be able to view the mongo db data.
I have found this: https://docs.mongodb.com/manual/core/authentication/
And have tried to use the db.auth() method however I do not understand how this fully works.
I assume I first have to create a user (I will only want one user for the db mongo shell) and then the user will need to authenticate?
Any help on this would be appreciated!