How To Secure #MongoDB on #Ubuntu 20.04 ?
To enable authentication, you must edit mongod. conf , MongoDB's configuration file. Once you enable it and restart the Mongo service, users will still be able to connect to the database without authenticating.
However, they won't be able to read or modify any data until they provide a correct username and password.
https://ibmimedia.com/blog/179/configure-mongodb-authentication-on-ubuntu