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

Sharded clusters v4.2, 4.0, and 3.6 do not raise error if a comment is sent with count command

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • ALL
    • Hide

      Connect to a sharded cluster v 3.6 - 4.2, and execute count command with comment:

      mongos> db.version()
      4.0.8
      mongos> db.runCommand({count: 'users', comment: {message: 'hello'}})
      {
      	"shards" : {
      		
      	},
      	"n" : 0,
      	"ok" : 1,
      	"operationTime" : Timestamp(1650975508, 1),
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1650975508, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      }
      

      When same command is executed on standalone:

      > db.version()
      4.0.8
      > db.runCommand({count: 'users', comment: {message: 'hello'}})
      {
      	"ok" : 0,
      	"errmsg" : "comment value is not a string",
      	"code" : 2,
      	"codeName" : "BadValue"
      }
      
      Show
      Connect to a sharded cluster v 3.6 - 4.2, and execute count command with comment: mongos> db.version() 4.0.8 mongos> db.runCommand({count: 'users', comment: {message: 'hello'}}) { "shards" : { }, "n" : 0, "ok" : 1, "operationTime" : Timestamp(1650975508, 1), "$clusterTime" : { "clusterTime" : Timestamp(1650975508, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } When same command is executed on standalone : > db.version() 4.0.8 > db.runCommand({count: 'users', comment: {message: 'hello'}}) { "ok" : 0, "errmsg" : "comment value is not a string", "code" : 2, "codeName" : "BadValue" }

      Count command docs states that count command supports a comment from version 4.4. Older server versions raise an error when receive count command with a comment. However, if cluster is in a sharded topology, no error is raised.

      Expected behavior is that server raises an error in all topologies.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            dmitry.rybakov@mongodb.com Dmitry Rybakov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: