[SERVER-39852] Collections incorrectly shown as empty in shell Created: 26/Feb/19  Updated: 29/Oct/23  Resolved: 29/Mar/19

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 4.1.10

Type: Bug Priority: Major - P3
Reporter: David Golub Assignee: Gabriel Russell (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-40190 shell does not correctly respond to i... Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2019-04-08
Participants:

 Description   

If the listDatabases command empty: false but does not specify a size for a collection, the shell will still show the collection as empty when running list databases.



 Comments   
Comment by Githook User [ 29/Mar/19 ]

Author:

{'name': 'Gabriel Russell', 'username': 'gabrielrussell', 'email': 'gabriel.russell@mongodb.com'}

Message: SERVER-39852 show "empty" databases as "(empty)"

  • databases with reported non-zero sizes will be displayed
    as they always have, with their size displayed after the name
  • databases that the server reports as empty, which generally
    indicates that it contains no collections, will be decorated
    with "(empty)"
  • databases that the server reports as taking up 0 bytes will
    now listed without any decoration
    Branch: master
    https://github.com/mongodb/mongo/commit/ad8a4c8cdf2a2c3ff6f6f56e61deb21c2239e29f
Comment by David Golub [ 28/Mar/19 ]

Looks good. Thanks so much for your work on this.

Comment by Bernie Hackett [ 12/Mar/19 ]

My 2 cents:

david.golub's request seems reasonable. The listDatabases command is returning "empty: false". The database is not empty. The shell prints "(empty)" after the database name because the sizeOnDisk field in the listDatabases response was rounded to 0, not because it actually is 0.

This request isn't about the listDatabases command (or drivers or anything else), it's about the shell.

Let me restate the request (correct me if I'm wrong David):

When I type "list databases" in the mongo shell and hit enter, if the listDatabases command returns "empty: false" for a database, don't print "(empty)" after the database name.

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