[DOCS-5432] Clarify "show dbs" behavior Created: 14/May/15  Updated: 30/Oct/23  Resolved: 01/Nov/22

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Minor - P4
Reporter: Kay Kim (Inactive) Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-18313 Commnad "show dbs" does not list all ... Closed
Participants:
Days since reply: 1 year, 14 weeks, 1 day ago
Story Points: 0.5

 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.



 Comments   
Comment by Education Bot [ 01/Nov/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Comment by Kevin Adistambha [ 27/Sep/18 ]

The database size number next to the database names needs to be documented as reflecting the database size on disk: https://github.com/mongodb/mongo/blob/v4.0/src/mongo/shell/utils.js#L882

Therefore nodes in a replica set would be expected to have different database sizes, especially a newly synced member.

Generated at Thu Feb 08 07:50:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.