[SERVER-50070] collStats does not return error code when asked to operate on a non-existent collection in an existing database Created: 02/Aug/20  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: 3.6.18
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Oleg Pudeyev (Inactive) Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to MONGOID-4915 Add more test configurations, fix sha... Closed
is related to SERVER-51206 collStats command does not return an ... Closed
Assigned Teams:
Query Optimization
Operating System: ALL
Participants:

 Description   

This affects 3.6 and potentially earlier servers.

Database exists, collection does not:

MongoDB Enterprise mongos> db.runCommand({collStats:'foo'})
{
	"sharded" : false,
	"primary" : "shard01",
	"ns" : "mongoid_test.foo",
	"ok" : 0,
	"errmsg" : "Collection [mongoid_test.foo] not found.",
	"operationTime" : Timestamp(1596397090, 1),
	"$clusterTime" : {
		"clusterTime" : Timestamp(1596397090, 1),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}

Neither database nor collection exist:

MongoDB Enterprise mongos> db.runCommand({collStats:'foo'})
{
	"ok" : 0,
	"errmsg" : "database bar not found",
	"code" : 26,
	"codeName" : "NamespaceNotFound",
	"operationTime" : Timestamp(1596397102, 1),
	"$clusterTime" : {
		"clusterTime" : Timestamp(1596397102, 1),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}

Note that the second command had an error code (26) and the first command did not have an error code.

4.0 uses error code 8 here as far as I can tell.


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