Configure Database Access

MongoDB Atlas requires a database user to authenticate database connections.

Follow these steps:

  1. Open the Database Access section.
  2. Add a new database user.
  3. Choose password-based authentication.
  4. Generate a strong password.
  5. Assign the minimum database privileges required for the application.
  6. Save the database user.

Do not confuse your MongoDB Atlas website login with the database user credentials.

The application uses the database user credentials to authenticate its MongoDB connection.

For production applications, follow the principle of least privilege and avoid using broad administrative roles.

Database Credentials

Do not share database credentials or include them in frontend JavaScript. Only the backend should connect using privileged database credentials.

Key Takeaways
  • Atlas database users are different from Atlas website users.

  • Use strong database passwords.

  • Grant only the database permissions required by the application.