How do I know which command generated this message? msg: Deprecated operation requested

After I upgraded mongodb from 4.4.28 to 5.0.25, the following message appeared in the log. How do I know which command generated this message?
It should be noted that the mongodb driver version already meets the requirements of mongodb 5.0.25.
{“t”:{“$date”:“2024-03-27T09:05:07.187+00:00”},“s”:“W”, “c”:“COMMAND”, “id”:5578800, “ctx”:“conn57718”,“msg”:“Deprecated operation requested. The client driver may require an upgrade in order to ensure compatibility with future server versions. For more details see https://dochub.mongodb.org/core/legacy-opcode-compatibility",“attr”:{“op”:“query”,“clientInfo”:{“application”:{“name”:“xxxx”},“driver”:{“name”:“mongo-csharp-driver”,“version”:“2.19.0.0”},“os”:{“type”:“Linux”,“name”:"Linux 5.10.178-162.673.amzn2.x86_64 #1 SMP Mon Apr 24 23:34:06 UTC 2023”,“architecture”:“x86_64”,“version”:“5.10.178-162.673.amzn2.x86_64”},“platform”:“.NET 6.0.26”}}}
{“t”:{“$date”:“2024-03-27T09:05:35.969+00:00”},“s”:“W”, “c”:“COMMAND”, “id”:5578800, “ctx”:“conn57724”,“msg”:“Deprecated operation requested. The client driver may require an upgrade in order to ensure compatibility with future server versions. For more details see https://dochub.mongodb.org/core/legacy-opcode-compatibility",“attr”:{“op”:“query”,“clientInfo”:{“application”:{“name”:“xxxx”},“driver”:{“name”:“mongo-csharp-driver”,“version”:“2.16.0.0”},“os”:{“type”:“Linux”,“name”:"Linux 5.10.178-162.673.amzn2.x86_64 #1 SMP Mon Apr 24 23:34:06 UTC 2023”,“architecture”:“x86_64”,“version”:“5.10.178-162.673.amzn2.x86_64”},“platform”:“.NET 6.0.26”}}}
{“t”:{“$date”:“2024-03-27T09:06:09.947+00:00”},“s”:“W”, “c”:“COMMAND”, “id”:5578800, “ctx”:“conn57741”,“msg”:“Deprecated operation requested. The client driver may require an upgrade in order to ensure compatibility with future server versions. For more details see https://dochub.mongodb.org/core/legacy-opcode-compatibility",“attr”:{“op”:“query”,“clientInfo”:{“application”:{“name”:“xxxx”},“driver”:{“name”:“mongo-csharp-driver”,“version”:“2.16.1.0”},“os”:{“type”:“Linux”,“name”:"Linux 5.10.178-162.673.amzn2.x86_64 #1 SMP Mon Apr 24 23:34:06 UTC 2023”,“architecture”:“x86_64”,“version”:“5.10.178-162.673.amzn2.x86_64”},“platform”:“.NET 6.0.26”}}}

try this link the error message listed.

then check the driver’s own documents MongoDB C# Driver — C#/.NET

If you are the original writer of your code, you may immediately recognize what changes are required.

Hi, @wu_xu,

This message is warning about the imminent removal of the legacy wire protocol (OP_QUERY, OP_INSERT, OP_UPDATE, etc.), which were replaced by the more generic and extensible wire protocol based around OP_MSG in MongoDB 3.6. You can tell that it was an OP_QUERY by “op”:“query”. In many cases, drivers must use OP_QUERY to start the initial handshake because the driver does not know which version of MongoDB it is connecting to. Once the driver determines that the server is at least MongoDB 3.6 (by maxWireVersion: 6 in the handshake response), it upgrades to OP_MSG.

To alert users that they have to update their drivers, this legacy wire protocol warning was added in SERVER-58337. Unfortunately it didn’t differentiate between the initial handshake subsequent commands often resulting in false positives. SERVER-61030 added these commands to the allowlist for OP_QUERY in 5.2.0. It is available in 6.0, but has not been backported to 5.0. Thus these spurious warnings should disappear from your logs once you upgrade to 6.0 or later.

Because MongoDB 3.6-compatible and later drivers will automatically upgrade to OP_MSG soon after the first handshake message and the server has a rate-limiting feature per client connection, your MongoDB 5.0 logs shouldn’t be overwhelmed by these warnings. These warnings will stop being logged once you upgrade to MongoDB 6.0 or later.

Hope this explanation helps.

Sincerely,
James

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.