-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
We implemented the apiVersion, apiStrict, and apiDeprecationErrors parameters in MongoDB 4.9 (some of the work was released in 4.7 and 4.8.)
In MongoDB 4.4, before the server was aware of these parameters, some commands ignore them and some don't:
> // Connected to mongod 4.4.1. > db.runCommand({ping: 1, apiVersion: "1"}) { "ok" : 1 } > db.runCommand({insert: "collection", documents: [{}], apiVersion: "1"}) { "ok" : 0, "errmsg" : "BSON field 'insert.apiVersion' is an unknown field.", "code" : 40415, "codeName" : "Location40415" }
arun.banala suggests an FCV check in MongoDB 4.9+ to ignore these parameters if FCV < "4.9". Then in a mixed-version cluster with some nodes running 4.4 and some running 5.0, the API parameters will be consistently ignored until the cluster is fully upgraded to 5.0 and setFeatureCompatibility: "5.0" has succeeded.
Alternatively we could error if apiVersion is passed and FCV < "4.9". I'm not sure what the right behavior is.