Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-50070

collStats does not return error code when asked to operate on a non-existent collection in an existing database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: 3.6.18
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:
      None
    • Operating System:
      ALL

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              oleg.pudeyev Oleg Pudeyev
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: