[SERVER-63315] Count command only accepts a string comment but should accept any BSON type in 4.4 Created: 04/Feb/22  Updated: 29/Oct/23  Resolved: 02/Mar/22

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

Type: Bug Priority: Minor - P4
Reporter: Edwin Zhou Assignee: Denis Grebennicov
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DRIVERS-2188 Add 'comment' option to EstimatedDocu... Closed
Duplicate
is duplicated by SERVER-65954 Sharded clusters v4.2, 4.0, and 3.6 d... Backlog
Related
is related to SERVER-29794 Adding a comment to all commands Closed
is related to SERVER-44847 Clean up explicit 'comment' fields na... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QE 2022-03-07
Participants:

 Description   

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)."



 Comments   
Comment by Arun Banala [ 22/Feb/22 ]

edwin.zhou Thank you for pointing this out. Since the count and distinct accepted the comment parameter even before 4.4, I think we forgot to remove the validation for those. SERVER-44847 should be fairly straight forward to backport. I've requested a backport.

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