Insert commands never send from the MongoDB CLI

I’m working on a project that is comparable with what Wireshark does. In my tests with MongoKitten, all is well. However, once I use the MongoDB CLI (on macOS), all commands work well except the insert command. It’s not only failing, it’s never sent to begin with.

Is there any way to debug this?

Hi Joannis!
Can you post the result of the command? How do you know the command is not sent?

Can you elaborate on what you mean by this? Are you referring to analysing or decoding packets over the wire? WireShark passively captures/analyses network traffic so shouldn’t interfere with client compatibility.

Given the description of an insert command not working, it sounds like you perhaps are developing a proxy which isn’t relaying commands/responses as expected. I would normally recommend a tool like WireShark to inspect the network communication and determine what is different between your working driver environment and the mongo shell ;-).

What specific version of the mongo shell and server are you using (as reported by version() and db.version()) and how are you detecting that the insert command is not sent? What is the result in the mongo shell?

If you are developing something like a proxy, can you confirm how you are altering the wire protocol communication and what version(s) of the wire protocol you are supporting?

The mongo shell relies on the wire protocol version for context on the connected server which may also alter the message sent (for example, older servers do not support the modern OP_MSG opcode). Modern versions of the mongo shell also convert inserts into bulk write commands, so you may not see an insert command if you are filtering network traffic to an expected opcode.

Regards,
Stennie

Hey. I know the command it not sent since there’s no TCP data leaving the client regarding insert. This is during the time the CLI is polling for a response.

@Stennie I most definitely am interfering, but I found the issue yesterday. MongoDB’s C library expects the minimum wire version to be 0. My handshake had a minimum wire version of 2, 3 or 4 (have to read the source code for that).

I am indeed building a proxy for MongoDB for a variety of reasons & use cases :slight_smile: So far it also taught me about some details about using OP_MSG sequences chunks.