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

Clarify "show dbs" behavior

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor - P4
    • Resolution: Unresolved
    • None
    • None
    • Server
    • None
    • 0.5
    • true

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                3 years, 45 weeks, 3 days ago