Understanding User Creation in MongoDB: admin Database vs. Other Databases

  1. A user can be created in any database.
  2. The database that a user is created in is that user’s ‘authentication database’. That user must then specify its authentication database when it logs in.

By convention as of MongoDB v5, users and roles are assumed to be in the ‘admin’ database unless otherwise specified.