[SERVER-58864] dropDatabase should return some detail on whether a db was actually dropped Created: 26/Jul/21  Updated: 27/May/22  Resolved: 27/May/22

Status: Closed
Project: Core Server
Component/s: Catalog
Affects Version/s: 5.0.0
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Stennie Steneker (Inactive) Assignee: Matt Kneiser
Resolution: Won't Fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-55145 Make dropping a nonexistent database ... Closed
Sprint: Execution Team 2021-12-27, Execution Team 2022-01-10, Execution Team 2022-01-24, Execution Team 2022-02-07, Execution Team 2022-03-07, Execution Team 2022-04-18, Execution Team 2022-05-30
Participants:

 Description   

The dropDatabase command returns

{ "ok" : 1}

even when dropping a database that does not exist.

Changing the ok result would be a significant breaking change, but it would be helpful to return some detail to confirm whether the command succeeded AND a database was dropped.

The drop command returns an errmsg when attempting to drop a non-existent collection:

> db.runCommand({'drop': 'foo'})
{
	"ok" : 0,
	"errmsg" : "ns not found",
	"code" : 26,
	"codeName" : "NamespaceNotFound"
}



 Comments   
Comment by Matt Kneiser [ 27/May/22 ]

Closing after reaching out to tommaso.tocci@mongodb.com who agrees this isn't worth pursuing.

Comment by Stennie Steneker (Inactive) [ 29/Jul/21 ]

Note: MongoDB 4.4 and earlier include a dropped field listing the dbname if it existed: https://github.com/mongodb/mongo/blob/r4.4.7/src/mongo/db/commands/dbcommands.cpp#L159

Apparently this was not reliable so the dropped field was removed in 4.9.0 per SERVER-55145.

Generated at Thu Feb 08 05:45:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.