Brief about mongo default databases

MongoDB has several default databases and collections that are created automatically when you install and start MongoDB. These databases and collections serve various purposes related to MongoDB's functionality and management. Here's a brief overview of the default databases in MongoDB:

  1. admin:

    • The admin database is a system database that stores administrative information and credentials for managing MongoDB instances.
    • It contains built-in roles and users required for administrative tasks, such as cluster management, user management, authentication, and authorization.
    • Typically, administrative users with privileges to perform administrative tasks are created in the admin database.
  2. config:

    • The config database is used in MongoDB sharded environments to store configuration information about the sharded cluster.
    • It contains collections like chunks, collections, databases, shards, and tags that store metadata about the sharding configuration, distributed data chunks, and shard distribution.
  3. local:

    • The local database is primarily used for internal MongoDB operations and does not store user data or application-related collections.
    • It contains collections such as startup_log, oplog.rs, and replset.minvalid that are used for replication, internal logging, and maintaining the local state of MongoDB instances.
  4. test:

    • The test database is a default database created for testing purposes.
    • It is often used by developers and testers to experiment with MongoDB features, perform test queries, and validate application functionality without affecting production data.
    • The test database is not meant for storing production data and is automatically dropped when the MongoDB instance is restarted.
  5. system (deprecated):

    • In older versions of MongoDB (prior to 4.2), there used to be a system database that stored system collections related to indexes, users, roles, and other system metadata.
    • However, starting from MongoDB 4.2, the system database is deprecated, and its functionality is merged into other system databases like admin, config, and local.

It's important to note that while these default databases are created automatically by MongoDB, they may not contain user data or application-specific collections initially. Developers and administrators can create additional databases and collections as needed for storing application data, managing users, and organizing resources within MongoDB deployments.

No comments:

Post a Comment

Index