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

Count command only accepts a string comment but should accept any BSON type in 4.4

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.4.14
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • QE 2022-03-07

      SERVER-29794 generally implements comment on all commands in 4.4 and is available only if featureCompatibilityVersion is set to 4.4. SERVER-44847 removes the old comment command for count in 5.0.

      I expect

      db.runCommand({count: "documents", comment: true })

      to work on both 4.4 and 5.0.

      However, using this command in 4.4.12 with

      db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )

      does not accept

      db.runCommand({count: "documents", comment: true })

      and returns the error:

      "errmsg" : "BSON field 'count.comment' is the wrong type 'bool', expected type 'string'",

      I suspect in 4.4, the comment command that SERVER-44847 removes is being used instead of SERVER-29794.

      This is inconsistent with our documentation that says the comment can be "any valid BSON type (string, integer, object, array, etc)."

            denis.grebennicov@mongodb.com Denis Grebennicov
            edwin.zhou@mongodb.com Edwin Zhou
            0 Vote for this issue
            9 Start watching this issue