If you’re upgrading a ReplicaSet from a version before 3.2 of MongoDB to a new version, you will run into this warning when connecting to the shell. Protocol Version 0 is not supported in MongoDB 4.0.

Checking Protocol Compatibility

To verify which protocol version the ReplicaSet is using, run the below command:

rs.status().optimes.lastCommittedOpTime.t

If the result is -1 then you’re using protocol version 0, if the result is greater than -1 then you’re using protocol version 1.

Update Protocol Version

In order to change the protocol version of the ReplicaSet, it must be reconfigured with the new property. Connect to the primary in your ReplicaSet and execute the following in order:

cfg = rs.conf();
cfg.protocolVersion=1;
rs.reconfig(cfg);

You can now recheck the protocol version using the same command from above.

rs.status().optimes.lastCommittedOpTime.t

Share This