Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5432

Clarify "show dbs" behavior

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: Server
    • Labels:
      None
    • 0.5

      Documentation Changes

      • Make a note in reference/mongo-shell explaining that empty databases are not listed.
      • Explain that "use <db>" does not create a database.

      Behavior Summary

      Databases are created and exist after inserting the first document into a collection in the database. Databases and collections are created implicitly; however, creating a database or collection object in your client does not create a database or collection. use <db> does not create new database files.

      Empty databases are not listed in the output of show dbs. This is partially storage engine dependent. MMAPv1, it's impossible to have an extant but empty database: you cannot create a database except by inserting data. Even if you later drop that data, there is a small amount of internal overhead that remains. The one exception is that before 3.0, show dbs reported the admin database as empty in some cases, but there were no corresponding. WiredTiger does not report databases that do not have data, other storage engines may have different behavior here.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              1 year, 25 weeks, 2 days ago